简体   繁体   English

如何在不生成EXE的情况下构建Delphi项目

[英]How to build a Delphi project without generating EXE

I'm wondering if there's a way to build a .dpr using dcc32, but skipping the linking part. 我想知道是否有一种使用dcc32构建.dpr的方法,但是跳过了链接部分。 I work on a very large project, that's been divided in sub-projects for modular compilation. 我从事的是一个非常大的项目,该项目分为多个子项目进行模块化编译。 The problem is that every sub-project, when compiled, generates an EXE files which is absolutely unnecessary, and this step also increases the build time. 问题在于,每个子项目在编译时都会生成绝对不需要的EXE文件,并且此步骤还会增加生成时间。

Any ideas? 有任何想法吗?

If the sub-projects exist solely to facilitate modular compilation (as you have mentioned in the comments on the question) then this attempt to "optimise" the build is at least partly responsible for causing the delays you are trying to eliminate. 如果子项目仅是为了方便模块化编译而存在(如您在问题注释中所提到的),则这种“优化”构建的尝试至少部分负责导致您要消除的延迟。

When building in the IDE, the compiler will already only compile units that have changed since the previous compilation. 在IDE中进行构建时,编译器将仅编译自上次编译以来已更改的单元。 Your sub-projects are forcing the compiler to make this assessment on the units involved at least twice. 您的子项目迫使编译器至少对所涉及的单元进行两次评估。 Once for each sub-project and then again for the "real" project. 一次用于每个子项目,然后再次用于“真实”项目。

In addition, the compiler is having to link and emit the EXE for each sub-project. 此外,编译器必须链接并为每个子项目发出EXE。 EXE's which you say are not actually required as an output of your project build. 您所说的EXE不一定是项目生成的输出。

You will improve your build times by simply eliminating the redundant "sub-projects". 您只需消除多余的“子项目”,即可缩短构建时间。

If the sub-projects added some other value, such as for example providing automated test coverage, then the overhead of these projects might be considered worthwhile, but this does not appear to be the case here. 如果子项目增加了一些其他价值,例如提供了自动测试覆盖范围,那么这些项目的开销可能被认为是值得的,但是在这里似乎并非如此。

One other thing to bear in mind is that the compiler decides whether to re-compile a unit based on whether each unit has itself changed. 要记住的另一件事是,编译器根据每个单元是否已更改来决定是否重新编译一个单元。 However, if conditional directives or other compiler settings have changed then all units should be recompiled otherwise the effect of the changed compiler settings is not applied (and can itself lead to strange behaviours and errors if these changed settings are applied to some units - the changed ones - and not others). 但是,如果条件指令或其他编译器设置已更改,则应重新编译所有单元,否则将不应用更改的编译器设置的效果(如果将这些更改的设置应用于某些单元,则其本身可能导致奇怪的行为和错误-已更改一个-而不是其他)。

When building under the IDE this requires you to remember to perform a full build after making changes to compiler settings. 在IDE下进行构建时,这要求您记住对编译器设置进行更改后执行完整的构建。 In a dedicated build process it is generally advisable to always perform a full build in a "clean room" environment. 在专门的构建过程中,通常建议始终在“无尘室”环境中执行完整构建。 That is deleting all compilation by-products (dcu's etc) either before or after each build. 那就是在每次构建之前或之后删除所有编译副产品(dcu等)。

NOTE: With these redundant sub-projects you again have created more work and potential trouble for yourself by having to ensure that your compiler settings are consistent across all sub-projects and the "master" project. 注意:使用这些冗余子项目,您必须确保所有子项目和“主”项目之间的编译器设置保持一致,从而又为自己带来了更多工作和潜在麻烦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM