Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 600
Peter Turner Avatar asked Dec 07 '11 14:12

Peter Turner


2 Answers

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.

like image 121
David Heffernan Avatar answered Nov 11 '22 03:11

David Heffernan


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.

Project Options - Search Path

like image 37
Peter Turner Avatar answered Nov 11 '22 05:11

Peter Turner