🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.commandlinetools
Article #180

Re: Using paths for command line compiling

#180
From: Caleb Hattingh
Date: Thu, 06 Mar 2008 08:50
51 lines
3259 bytes
Debbie Erickson wrote:
> Hello, all.  I am using Delphi 6.  In the IDE, all my paths are in the Environment|library tab.  My project heavily uses 3rd party components , which are not being found when I do a command line compile.  How do I utilize these paths?  

Tools > Options > Environment options > Show Command Line (checkbox)

Then, copy what you can out of the build messages and insert that into your script as the command line (although I think the command line is always given in the Build Output pane?).  If you want to get fancier, pull out all those long paths from the registry.  Here is a portion of a python script I wrote to do command-line builds:

*************************************

# inject this into an environment variable
# Check whether win64 is running
if os.path.exists(r'c:\Program files (x86)'):
    os.environ['BDS'] = 'C:\\Program Files (x86)\\CodeGear\\RAD Studio\\5.0\\'
else:
    os.environ['BDS'] = 'C:\\Program Files\\CodeGear\\RAD Studio\\5.0\\'

def ReplaceEnvironVars(input):
    input = input.replace(r'$(BDS)',os.environ['BDS'])
    input = input.replace(r'$(BDSCOMMONDIR)',os.environ['BDSCOMMONDIR'])
    input = input.replace(r'$(ALLUSERSPROFILE)',os.environ['ALLUSERSPROFILE'])
    items = input.split(';')
    items = ['"'+i+'"' for i in items]
    input = ';'.join(items)
    input = input.replace(r'\\','\\')
    return input

# Store Delphi library paths from Registry
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,r'Software\Borland\BDS\5.0\Library')
INC = _winreg.QueryValueEx(key,'Search Path')[0]
INC = ReplaceEnvironVars(INC)
UPATH = OPATH = RPATH = INC
BPL = _winreg.QueryValueEx(key, 'Package DPL Output')[0]
BPL = ReplaceEnvironVars(BPL)
DCP = _winreg.QueryValueEx(key, 'Package DCP Output')[0]
DCP = ReplaceEnvironVars(DCP)
_winreg.CloseKey(key)


*************************************

 and then, with this command line string template:

*************************************
CMDLINE_TEMPLATE = 'dcc32.exe -W -B %s -I%s -LE%s -LN%s -O%s -R%s -U%s -E%s -GD --no-config %s'
*************************************

I substitute with

*************************************
    cmdline = CMDLINE_TEMPLATE % (definestring,INC,BPL,DCP,OPATH,RPATH,UPATH,outputfolder,fname)
*************************************
Technical Details
Message-ID: <47cfb047@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47cede0b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: ff8f1,3c1f2763a5f58086
X-Google-Attributes: gidff8f1,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 06 Mar 2008 10:50:34 +0200
From: Caleb Hattingh <caleb.hattingh.no.spam@gmail.com>
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
MIME-Version: 1.0
Newsgroups: borland.public.delphi.commandlinetools
Subject: Re: Using paths for command line compiling
References: <47cede0b$1@newsgroups.borland.com>
In-Reply-To: <47cede0b$1@newsgroups.borland.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 41.241.112.193
Message-ID: <47cfb047@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1204793415 41.241.112.193 (6 Mar 2008 00:50:15 -0700)
Lines: 52
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail