GabrielMoraru 31 Posted 13 hours ago (edited) So, I have a program that uses the precompiled units of a library. This: Allows me to keep the Search Paths totally empty (as they should be) Prevents the compiler from keep recompiling the files of the library unnecessarily, saving compilation time. But if the library has DFM files, the compiler will throw that famous "where are my DFM files?" error message. The "solution" (well, it is not a real solution, but rather a dirty trick) is to (manually or by script) copy the DFM files to the DCU folder of that library. Four output DCU paths, four copies. What a nasty "solution"... So, did anyone found a more elegant way to solve this? I see in some old DProj files an entry called <DCC_ResourcePath>, but there is no page in "Project options" or in IDE's "Tools -> Options" to set that path. Edited 10 hours ago by GabrielMoraru Share this post Link to post
PeterBelow 249 Posted 12 hours ago 1 hour ago, GabrielMoraru said: So, I have a program that uses the precompiled units of a library. This: Allows me to keep the Search Paths totally empty (as they should be) Prevents the compiler from keep recompiling the files of the library unnecessarily, saving compilation time. But if the library has DFM files, the compiler will throw that famous "where are my DFM files?" error message. The "solution" (well, it is not a real solution, but rather a dirty trick) is to (manually or by script) copy the DFM files to the DCU folder of that library. Four output DCU paths, four copies. What a nasty "solution"... So, did anyone found a more elegant way to solve this? I see in some old DProj files an entry called <DCC_ResourcePath>, but there is no page in "Project options" or in IDE's "Tools -> Options" to set that path. I just add the "library" foms to the project that needs them, this way the required path is in the dpr file uses clause. Btw.: I think this DCC_RessourcePath is for the resource compiler and you can set it under that node in the Options dialog. Never needed that myself, though. Share this post Link to post
GabrielMoraru 31 Posted 10 hours ago (edited) > "I just add the "library" forms to the project that needs them" a) Won't this break the second rule: "2. Prevents the compiler from keep recompiling the files of the library unnecessarily, saving compilation time"? b) Plus, this way you have to maintain the files twice. If you add/remove a form from your package, you need to manually add/remove it also from all DPR files that use that form. If so, then copying the forms to the binary output (DCU) folder of the library via a post-build script it is still the best "hack". > "I think this DCC_RessourcePath is for the resource compiler and you can set it under that node in the Options dialog. Never needed that myself, though" I will try that! Thanks! Edited 10 hours ago by GabrielMoraru Share this post Link to post
dwrbudr 8 Posted 10 hours ago Could you please share your PostBuild script and the entire sequence copying those files to the sub-folders. I've done something similar, but on many libraries msbuild fails under 64-bit mode while compiling the .dproj files under command-line using a bat file. In Delphi IDE all is OK, but msbuild fails building some 64-bit libraries. build.bat: call "C:\Program Files (x86)\Embarcadero\Studio\23.0\bin\rsvars.bat" msbuild /t:rebuild /p:Config=Release /p:platform=Win32 MyPackage.dproj msbuild /t:rebuild /p:Config=Debug /p:platform=Win32 MyPackage.dproj 64bit build.bat: call "C:\Program Files (x86)\Embarcadero\Studio\23.0\bin64\rsvars64.bat" msbuild /t:rebuild /p:Config=Release /p:platform=Win64 MyPackage.dproj msbuild /t:rebuild /p:Config=Debug /p:platform=Win64 MyPackage.dproj This is my postbuild event: .\..\copyres.bat "$(PROJECTDIR)\..\" "$(PROJECTDIR)\$(Platform)\$(Config)" copyres.bat: @echo off for /r %1 %%x in (*.res) do @copy "%%x" %2 /Y > NUL for /r %1 %%x in (*.dfm) do @copy "%%x" %2 /Y > NUL for /r %1 %%x in (*.dcr) do @copy "%%x" %2 /Y > NUL The bigger problem I have is that I need to set some component packages Library path to point to their \Source\ folder (instead of to the precompiled Win32\ and Win64\ .dcu folders) if my program overrides some of the Delphi files like Vcl.Forms.pas/Vcl.Controls.pas, etc. So my question is: Is there anyway to recompile a component package using custom Vcl.Forms, Vcl.Controls? Share this post Link to post
Attila Kovacs 644 Posted 9 hours ago 3 hours ago, GabrielMoraru said: Prevents the compiler from keep recompiling the files of the library unnecessarily, saving compilation time. Why would it recompile if it hasn't changed? Do you mean when building the app? Why would you build the app so often? 3 hours ago, GabrielMoraru said: So, did anyone found a more elegant way to solve this? Yeah, compiling them into binary DFMs would be more elegant 😄 I don't know how many DFMs a library can have, but it's not typical. Share this post Link to post
Uwe Raabe 2117 Posted 8 hours ago 3 hours ago, PeterBelow said: I think this DCC_RessourcePath is for the resource compiler and you can set it under that node in the Options dialog. Not quite, that setting is stored as BRCC_IncludePath. DCC_ResourcePath is indeed the correct way to provide the paths to look for the DFM resources. Unfortunately there is no UI to edit that. Manually editing the dproj file adding a node like <DCC_ResourcePath>..\lib\Source;$(DCC_ResourcePath)</DCC_ResourcePath> under the appropriate PropertyGroup will make the DFM files located in ..\lib\source to be found without exposing the PAS files in that folder. 2 Share this post Link to post
Uwe Raabe 2117 Posted 4 hours ago RSS-3125: Add Option to edit DCC_ResourcePath Share this post Link to post