🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.commandlinetools
2 messages
2 total messages Started by Debbie Erickson Wed, 05 Mar 2008 16:53
Using paths for command line compiling
#178
Author: Debbie Erickson
Date: Wed, 05 Mar 2008 16:53
5 lines
1114 bytes
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?  

Thanks!
Debbie
Re: Using paths for command line compiling
#180
Author: 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)
*************************************
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads