如何在命令行上编译我的 Delphi 项目?

发布于 2024-08-13 22:03:08 字数 232 浏览 8 评论 0原文

有没有人曾经成功编译过 Delphi 6 和 Delphi 6? 7(不是任何 Delphi > 7 )使用命令行的项目?

我看到的所有说明都不是很清楚到底需要什么去哪里!

我正在寻找分步说明。

答案应仅限于 Delphi 6 和 Delphi 6。 7:我了解 Delphi 2006 和 >使用 MSBuild 这要容易得多。

链接也受到高度赞赏。

迦特

Has anyone ever managed to compile their Delphi 6 & 7 (NOT any Delphi > 7 ) projects using the command line?

All the instructions I see are not very clear on what exactly needs to go where!

Am looking for step-by-step kind of instructions.

Answers should be limited to Delphi 6 & 7: I understand Delphi 2006 and > uses MSBuild which is far much easier.

Links are also high appreciated.

Gath

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

浮生面具三千个 2024-08-20 22:03:09

这并不难做到。我的计算机上安装了标准的 Delphi 5,当我打开命令提示符时,导航到 $(DELPHI)\Demos\Threads 目录并输入 dcc32.exe thrddemo.dpr 该应用程序是在命令行上构建的。

对于您自己的项目,您可能需要添加一些开关以包括文件目录、输出目录、定义或类似的内容。运行不带参数的 dcc32.exe 会给出开关和参数的列表。文档中也对此进行了描述。

为了可重复性,您应该创建一个批处理文件或常规 Makefile。

请注意,Delphi 目录中的项目 cfg 文件和公共 dcc32.cfg 都包含重要设置。有关它们如何影响构建的一些信息,请参阅例如 Delphi Wikia 上的此链接

This is not difficult to do. I have a standard Delphi 5 install on my machine here, and when I open a command prompt, navigate to the $(DELPHI)\Demos\Threads directory and enter dcc32.exe thrddemo.dpr the application is built on the command line.

For your own project you may need to add some switches to include file directories, output directories, defines or similar things. Running dcc32.exe without parameters gives a list of switches and parameters. It is all described in the documentation, as well.

For repeatability you should create a batch file or a regular Makefile.

Note that both the project cfg file and the common dcc32.cfg in the Delphi directory contain important settings. For some information about how they affect the build see for example this link on Delphi Wikia.

萌化 2024-08-20 22:03:09

对于构建自动化,我使用 Apache Ant,即 用于自动化软件构建过程的软件工具。我将它用于我的所有项目,从 Delphi 6 到 Delphi 2009,以及 Free Pascal。

它可以做的“开箱即用”的事情包括 MD5 校验和生成、ZIP 文件创建、文本搜索/替换(对于版权标头生成有用)、执行 SQL 语句、XSLT 处理。

例如,要使用 Delphi 6 编译所有项目,这是脚本(的一部分):

<target name="compile_d6">
  <!-- Compile with Delphi 6 -->
  <apply executable="${d6}\Bin\dcc32" failonerror="true" output="build-d6.log" >
    <!-- rebuild quiet -->
    <arg value="-B"/>
    <arg value="-Q"/>
    <!-- file paths -->
    <arg value="-I${source};${indy10}/Lib/System"/>
    <arg value="-O${source};${indy10}/D6;${jcl}/d6"/>
    <arg value="-U${source};${indy10}/D6;${jcl}/d6"/>  
    <!-- all *.dpr files in current directory -->
    <fileset dir=".">
      <patternset><include name="*.dpr"/></patternset>
    </fileset>
  </apply>
</target>

像 Hudson/Jenkins 这样的免费开源 CI(持续集成)服务器支持开箱即用的 Apache Ant 构建脚本,这意味着您可以每当您在源存储库中签入更改时,它们都会自动构建项目。

For build automation, I use Apache Ant, which is a software tool for automating software build processes. I use it for all my projects, from Delphi 6 to Delphi 2009, and Free Pascal.

Things it can do "out of the box" include MD5 checksum generation, ZIP file creation, text search/replace (useful for copyright header generation), execution of SQL statements, XSLT processing.

For example, to compile all projects with Delphi 6, this is (a part of) the script:

<target name="compile_d6">
  <!-- Compile with Delphi 6 -->
  <apply executable="${d6}\Bin\dcc32" failonerror="true" output="build-d6.log" >
    <!-- rebuild quiet -->
    <arg value="-B"/>
    <arg value="-Q"/>
    <!-- file paths -->
    <arg value="-I${source};${indy10}/Lib/System"/>
    <arg value="-O${source};${indy10}/D6;${jcl}/d6"/>
    <arg value="-U${source};${indy10}/D6;${jcl}/d6"/>  
    <!-- all *.dpr files in current directory -->
    <fileset dir=".">
      <patternset><include name="*.dpr"/></patternset>
    </fileset>
  </apply>
</target>

Free open source CI (Continous Integration) servers like Hudson/Jenkins support Apache Ant build scripts out of the box, which means that you can have them build the project automatically whenever you checked in a change in the source repository.

飞烟轻若梦 2024-08-20 22:03:09

您可以使用此命令行构建所有内容:

"C:\Program Files\Borland\Delphi7\Bin\DCC32.exe" -Q -B your-project.dpr

将此行放入 .bat 文件中,这样您就不需要总是键入它。看一下运行此命令的命令行选项:

"C:\Program Files\Borland\Delphi7\Bin\DCC32.exe" -h

顺便说一句:-Q 是安静编译,-B 将重建所有内容。如果您想要更快的编译,请不要使用 -B。

它将使用 your-project.cfg 文件中的所有选项。我发现这个 dof2cfg 可执行文件非常有用。有了它,我可以编辑 .dof 文本文件并将更改传播到命令行和 IDE。无需为每个项目编辑它。

长路径的重要警告: Delphi 7 命令行编译器有一个非常奇怪的错误。如果您的路径很长,它将失败并出现难以理解的错误:没有任何有意义信息的访问冲突。如果没有任何合理的动机而失败,请尝试减小最大路径大小和文件名大小。将项目放在根文件夹中通常可以解决。

You can build everything using this command line:

"C:\Program Files\Borland\Delphi7\Bin\DCC32.exe" -Q -B your-project.dpr

Put this line in a .bat file so you don't need to type it always. Take a look at the command line options running this:

"C:\Program Files\Borland\Delphi7\Bin\DCC32.exe" -h

BTW: -Q is quiet compile and -B will rebuild everything. If you want a quickier compilation don't use -B.

It will use all the options in your-project.cfg file. I've found this dof2cfg executable very useful. With it I can edit the .dof text file and propagate the change to the command line and IDE. No need to edit it for each project.

Important warning for long paths: Delphi 7 command line compiler has a very weird bug. If your path is very long, it will fail with an inscrutable error: a access violation without any meaningful information. If it fails without any reasonable motive, try to reduce the maximum path size and the filename size. Put the project in the root folder usually solve it.

旧街凉风 2024-08-20 22:03:09

FinalBuilder 使其变得非常简单。尝试一下。

FinalBuilder makes it very easy. Give it a try.

稀香 2024-08-20 22:03:09

我建议结合使用 NAnt 和 dcc32,但还有 Juancarlo Añez 的 "WAnt - Pascal 友好的构建工具”。我一直在使用 1.x 的修改版本而不是 2.x alpha。由于它是开源的,我可以扩展代码以使用与 NAnt 相同的格式以 XML 形式输出日志,因此我可以将其与 CruiseControl.NET 集成。

I would suggest combination of NAnt and dcc32, but there's also Juancarlo Añez's "WAnt - A Pascal-Friendly Build Tool". I've been using modified version of the 1.x instead of the 2.x alpha. Since it's open source, I could extend the code to output log in XML with the same format as NAnt, so I can integrate it with CruiseControl.NET.

丘比特射中我 2024-08-20 22:03:09

对于更高版本的 Delphi,应更改为:

“C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\DCC32.exe” -h

For later versions of Delphi, this should be changed to:

"C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\DCC32.exe" -h

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文