如何使用命令行编译 Delphi 7 项目组文件 (.bpg)?
我将很多项目分组到一个项目组中。所有信息都在project.bpg中。现在我想自动构建它们。
如何使用命令行构建所有项目?
我还在使用Delphi 7。
I've grouped a lot of projects in a project group. All the info is in the project.bpg. Now I'd like to automatically build them all.
How do I build all the projects using the command line?
I'm still using Delphi 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我自己从未尝试过,但是这里是一篇德语文章,描述了您可以使用
make -f ProjectGroup.bpg
因为*.bpg
本质上是 makefile。I never tried it myself, but here is a German article describing that you can use
make -f ProjectGroup.bpg
because*.bpg
s essentially are makefiles.您还可以从命令行或批处理文件运行 Delphi,并将 .bpg 文件名作为参数传递。
编辑:示例(对于 D2007,但可以针对 D7 进行调整):
===rebuild.cmd(摘录)===
You can also run Delphi from the command line or a batch file, passing the .bpg file name as a parameter.
Edit: Example (for D2007, but can be adjusted for D7):
=== rebuild.cmd (excerpt) ===
正如我对 Ulrich Gerhardt 答案的评论所说,如果您的项目位于子目录中,则 make project_group.bpg 是无用的。 Make 不会使用相对路径,并且项目将无法正确编译。
我制作了一个 python 脚本来编译每个子目录中的所有 DPR。这是我真正想做的,但我将保留上述答案的标记。虽然它对我没有用,但它确实回答了我的问题。
这是我的compile_all.py 脚本。我相信它可能会对某人有所帮助:
这种方法的另一个优点是您不需要将新项目添加到 bpg 文件中。如果它在子目录中,它将编译。
As I said as a comment to Ulrich Gerhardt answer, the make project_group.bpg is useless if your projects are in subdirectories. Make won't use relative paths and the projects won't compile correctly.
I've made a python script to compile all the DPRs in every subdirectory. This is what I really wanted to do, but I'll leave the above answer as marked. Although it didn't worked for me, It really answered my question.
Here is my script to compile_all.py . I believe it may help somebody:
Another vantage of this approach is that you don't need to add new projects to your bpg file. If it is in a subdir, it will compile.