How can I compile 32- and 64-bit DCUs into separate directories?

萝らか妹 提交于 2019-12-21 10:48:22

问题


I'm trying to maintain one repository, most everything in my code base is source, but we've got the QuickPDF library which is a bunch of precompiled DCU's. I'd like to put them in version control somehow but I don't want to have yet another option set for win64 that I'm going to forget about before I convert the rest of my trillion LOC codebase to win64.

What I was thinking was just having (and quickPDF is just an example, there's nothing special about this library other than its unfortunate precompiledness)

  • ctrls\quickpdf\QuickPDF.pas
  • ctrls\quickpdf\win32[*.dcu]
  • ctrls\quickpdf\win64[*.dcu]

From the looks of the folders in Program Files, Embarcadero does something similar with the VCL. There are even some precompiled things there, like VCL.Imaging.JPEG.pas.

How do I do the same thing? Do I need to specify win32 and win64 folders, or is there some magic somewhere I can tap in to?


回答1:


The magic you are talking about can be seen in the .dproj file for a plain vanilla XE2 VCL Forms app. The key ingredients are these variables:

  • $(Platform) which can be Win32 or Win64 on Windows.
  • $(Config) which is commonly either Debug or Release.

Then in the .dproj file the following XML performs the magic:

<PropertyGroup Condition="'$(Base)'!=''">
    <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
    <DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
</PropertyGroup>

You can use such tricks with the $(Platform) and $(Config) variables with any of the project options. So you just need to use these variables to set whatever option needs to be set for the compiler to find your pre-compiled DCUs.

To the best of my knowledge the option you need to set is the Search Path. Although I admit to being hazy about how the search path works since I personally never rely on search path and always explicitly include all source files in my projects. In your example you would add ctrls\quickpdf\($Platform) to the search path.




回答2:


That's simple, add:

  • ..\ctrls\quickpdf\$(Platform)

to your projects search path

Although you'll be surprised when you find this actually works since it shows up grayed out in the IDE.



来源:https://stackoverflow.com/questions/8417018/how-can-i-compile-32-and-64-bit-dcus-into-separate-directories

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!