I have a project (C:\Test\Test.dpr) that uses a file (External.pas) belonging to library (MyLib.DPK). All files in the library are accessible via 'Search' path but I also included External.pas directly in my DPR file:
program Test;
uses
External in '..\Packages\MyLib\External.pas', <------ the 'external' file
FormMain in 'FormMain.pas' {frmMain};
For this project I set the 'Output directory' and 'Output DCU dir' to ".\$(Platform)_$(Config)".
When I compile, the exe file all DCUs of this project are written in the correct output folder: c:\Test\Win64_Debug\
However, the External.dcu is generated in ..\Packages\MyLib\External.dcu
instead of c:\Test\Win64_Debug\
Why is that?
Let me ask the question in a different way: if to a DPR project I append a PAS file that is in a different folder, shouldn't all DCU files (including the external file) be generated in the same folder as the EXE file?
A Delphi compiled unit file is an intermediate compiler output file produced from the source code of each unit in your project. Delphi compiled unit files enable rapid compiling and linking.
dcu file is the file that the DCC compiler produces after compiling the . pas files (. dfm files are converted to binary resources, then directly processed by the linker).
From the documentation:
Output directory
Specifies where the compiler should put the executable file.
Unit output directory
Specifies a separate directory to contain the compiled units (.dcu).
It sounds like you need to specify the unit output directory as well as the output directory. Personally I tend to keep these two directories separate.
Yes the Project Options UI can be quite confusing especially because in order to access settings for each target platform you need to switch to that target platform via the dropdown list.
This part of the IDE could be made much better if you could simply see configurations for all target platforms at once.
Now if you want to be able to maintain output paths setting on one location (All configurations) you just need to make sure that specific target configurations are not overriding it.
To do so go to specific target configuration and then instead of clicking on the field entry itself click on the +
sign in front of it.
This will expand current property field and also show the values from parent configurations from which this property can be inherited from.
NOTE: While many properties can indeed be inherited (property values from target configuration are added to properties from parent scheme like) Output directory
and Unit output directory
since they can contain only one value are simply overridden.
So in order to make sure that output locations from All configurations
is used in every specific target configurations none of them should not have defined custom value for output locations.
In other words values from Release configuration - ...
or Debug configuration - ...
when you have specific property expanded must be empty like in the picture above.
Damn it... I did it again... I set the Target for 'All configurations - All Platforms' but the path for 'Debug config-64bit windows platform' was already set to something else. So, when I set the (correct) path in 'All configurations', the 'Debug config-64bit windows platform' remained as it was. I have 12 possible configurations (debug, release, pre-release) so I haven't seen that 'Debug config-64bit windows platform' remained set to the original value. The GUI for Project Options can cause lots of mistakes!
Thanks David. Sorry for wasting your time. I am still struggling with Delphi paths. There is nothing in the whole IDE as confusing/weird as the paths (search, output, library, etc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With