tags:

views:

423

answers:

3

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).

+1  A: 

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
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.
scrapdog
+4  A: 

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
No, it will not use. Under Hudson+MSBuild unit search path from IDE settings not used.
W55tKQbuRu28Q4xv
A: 

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.

cjrh
Library and browsing path is also in C:\Documents and Settings\<User Name>\Application Data\CodeGear\BDS\6.0\EnvOptions.proj (on XP) or C:\Users\<User Name>\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
mjustin
@mjustin, yes, that's right, it is even more work to handle those cases. It is better just to use MSBuild.
cjrh
Never really used MSBuild from the command line - Apache Ant and a build.xml file makes me happy, YMMV :)
mjustin
C:\source> msbuild MyAppName.dproj is all you need.
cjrh