[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 800
  • Last Modified:

Change the output directory using compiler directive

When developing my application I use the conditional DEBUG i.e. {$DEFINE DEBUG}.
What I want to do is, to put the debug version in direcotry c:\projects\myprojects\bin\debug and my release version (without the conditional DEBUG) in directory c:\projects\myprojects\bin\release

Is there any way to change the output directory using the compiler directive in the code?

0
huferry
Asked:
huferry
  • 4
  • 2
  • 2
2 Solutions
 
2266180Commented:
there is no such compiler directive. however you can do this from the command line:
dcc32 -Ec:\projects\myprojects\bin\debug -DDEBUG yourproject.dpr
and
dcc32 -Ec:\projects\myprojects\bin\release yourproject.dpr
this way you will not need to specify a  {$DEFINE DEBUG} directive everythwre (the one from the command line is valid for all files in the project) and you will also be able to automate the build process later (including version information, conditional customizations, etc)
0
 
huferryAuthor Commented:
I've defined the compiler directives in the Project|Options|Conditionals, it's the same as the passing it on the command line. But the point is, is it possible when Delphi sees DEBUG, then it'll create the executable somewhere else.
0
 
2266180Commented:
in delphi 7 there is no way of specifying the output directory from source at compilation time (using compiler directives). I don't know about earlier version (you can check the help on compiler directive to make sure).
I'd go with the command line options (that's the way I do all build procedures for my projects: it gives a large amount of control over what gets compiled and what and how is the putput)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
EddieShipmanCommented:
Write an expert to capture the BeforeCompile and change the DOF file...
the output dir is located in the [Directories]

0
 
huferryAuthor Commented:
Any suggestion on guide to write an expert?
0
 
EddieShipmanCommented:
There are several on BDN.
0
 
EddieShipmanCommented:
You can also check here:
http://www.gexperts.org/opentools/
0
 
EddieShipmanCommented:
There's a sample showing a BeforeCompile handler in the thread posts by Angus Johnson titled:
"How do you get the Compile time?"
here:
http://216.101.185.148/scripts/isapi.dll/execute?SearchFor=Compile+time+Angus+^Delphi&RecordLimit=250&Display=Article&Sort=Date
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now