4

Is there a way to instruct DCC32 to use the same library path that is used by the IDE (i.e. in Tools/Options/Environment Options/Delphi Options/Library - Win32)?

For obvious reasons, I do not want to maintain two lists of directories (one in a cfg file, one in the Delphi IDE).

kes
  • 5,983
  • 8
  • 41
  • 69

5 Answers5

5

If you are using Delphi 2006 or later, you can use MSBuild instead of dcc32, and MSBuild will use the same search path as the IDE

jasonpenny
  • 2,999
  • 1
  • 24
  • 23
1

You should have a cfg file in your project directory called yourprojectnamedpr.cfg which actually should contain all the directories defined in the IDE for that project.

Jorge Córdoba
  • 51,063
  • 11
  • 80
  • 130
  • 2
    This is what I am trying to avoid; I don't want to maintain more than one list of directories. If I change my search path, I don't want to go change the cfg file for every project as well. – kes Nov 30 '09 at 16:31
  • But only the project directories. Not the IDE environment options, in particular not the 'lib' path. – david Mar 31 '23 at 02:42
1

It is a lot of work to use DCC32 to build from the command line. MSBuild is far easier. The library path is stored in the registry, but the location depends on the Delphi version, for example (python code):

if BDSVER == '5.0':
    CompanyText = 'Borland'
else:
    CompanyText = 'CodeGear'

key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,'Software\\' + CompanyText + '\\BDS\\' + BDSVER + '\\Library')    
IncludePath = _winreg.QueryValueEx(key,'Search Path')[0]

# Then you must replace the environment vars $(BDS), $(BDSCOMMONDOR) etc
IncludePath = ReplaceEnvironVars(IncludePath)

And there is much more to do. You must also obtain the search path, and you must obtain conditional defines from the .dproj file, etc.

I wrote a complete automated build tool in python (for BDSVER >= 5), back when Delphi 2007 installed on XP x64 had a broken MSBuild. Later, it turned out that some required configuration files were not copied into the correct .NET folder by the Delphi installer. Copying these files to the correct location fixed the problem, and now I use MSBuild.

Caleb Hattingh
  • 9,005
  • 2
  • 31
  • 44
  • 2
    Library and browsing path is also in C:\Documents and Settings\\Application Data\CodeGear\BDS\6.0\EnvOptions.proj (on XP) or C:\Users\\AppData\Roaming\CodeGear\BDS\6.0\EnvOptions.proj if you're on Vista or Windows 7 - see http://stackoverflow.com/questions/1821112/how-does-msbuild-find-the-delphi-search-path – mjn Dec 01 '09 at 12:23
  • @mjustin, yes, that's right, it is even more work to handle those cases. It is better just to use MSBuild. – Caleb Hattingh Dec 02 '09 at 05:37
  • Never really used MSBuild from the command line - Apache Ant and a build.xml file makes me happy, YMMV :) – mjn Dec 03 '09 at 16:27
  • C:\source> msbuild MyAppName.dproj is all you need. – Caleb Hattingh Dec 04 '09 at 06:10
1

If you use an older Delphi (e.g. Delphi 7), you must put all your information in the "Search Path" Directory option in your IDE. It will be saved in your .dof file. The .dof file is the main reference of your project.

The IDE will also automatically update the .cfg every time you change the project configuration. The .cfg is the specifies the compilation option for the command line compiler. Both the .cfg and the .dof must be under version control.

If, instead of editing your .dof file from the IDE, you manually edit it, you can use the dof2cfg utility to generate a new .cfg from your .dof. You will have to put it in your build chain.

neves
  • 33,186
  • 27
  • 159
  • 192
1

This works for me:

call "C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\rsvars.bat"
msbuild project.dproj
roeland
  • 6,058
  • 7
  • 50
  • 67