Jump to content
ErikT

Passing info from build configurations to code

Recommended Posts

I am unsure if this is even possible in Delphi.

I have a GUI, designed for customer use, My employer wishes to have a version of the same software for internal use, where some extra features are available.

I intend to put these extra features on an extra TabSheet in a PageControl object. For regular customers, this TabSheet is invisible.

 

My intention was to have two different build configurations: One for customers and one for internal use. Then use a preprocessor symbol to let the code know which configuration it is.

However, I have read elsewhere, that Delphi doesn't have a preprocessor, so is this even possible to do?

I have defined this symbol in the IDE:

image.png.f2eedc27075999adae121a6b0f564f06.png

 

Then, in the FormCreate procedure, I have added this line:

{$IFDEF __BuilderGUI} TabSheet4.TabVisible := true; {$ENDIF}

However, the pascal line is never run. The compiler doesn't seem to "see" the symbol. I've also tried defining the symbol this way (even though I didn't believe in it):

image.png.a2093b7fc039d08a91066a77ad4d75e6.png

 

If I add {$DEFINE __BuilderGUI} in my code, the $IFDEF recognizes the symbol and acts accordingly. So at least that part works.

 

Am I doing something wrong in the symbol definition, or is what I'm trying to do simply not possible?

 

Should I instead include the $DEFINE in a file that is not included in the customer configuration?

Share this post


Link to post

Edit the internal build configuration and add __BuilderGUI to Conditions.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×