Great!!
Thanks very much Aaron.  That's exactly what I needed to know.  I'll try setting
these in the project options first and see how that works.  Appreciate yiur
help.
Mark

Aaron Scott-Boddendijk wrote:

> > is it possible to say something like:
> > if FLAG_AR_SET then {$DEFINE AR};
>
> Compiler conditionals occur before the compiling of the code purely by
> cutting out
> text that is defined as being out of the project
>
> EG
> {$define OPT_CLIENT1}
> showmessage(
>     {$IFDEF OPT_CLIENT1}
>         'Client1'
>     {$ELSE}
>         'Client2'
>     {$ENDIF}
> );
>
> when compiled the compiler will see
>
> showmessage(
>         'Client1'
> );
>
> That is, the compiler does not 'see' the other lines at all which is why you
> can't combine
> procedural code and compiler directives...
>
> in Project options there is an option to enter defines that will apply to
> the entire project,
> this is the best place to set the OPT_Client1Specific flag.  The other
> possibility if your
> structure of conditionals is more complex is to use an .INC file and add an
> include
> directive as the first line of every unit that needs those defines. EG
>
> Example.Inc
> -------------------------------
> {$IFDEF OPT_LowMem}
>     {$DEFINE FLAG_NoRecordCache}
>     {$DEFINE FLAG_NoTexturedForms}
> {$ENDIF}
>
> {$IFDEF RELEASE_COMMERCIAL}
> {$ENDIF}
>
> {$IFDEF RELEASE_LITE}
>     {$DEFINE FLAG_NoLinkMetaData}
>     {$DEFINE FLAG_SingleUser}
> {$ENDIF}
>
> {$IFDEF RELEASE_DEMO}
>     {$DEFINE FLAG_NoSave}
>     {$DEFINE FLAG_SingleUser}
> {$ENDIF}
> -------------------------------
>
> Then as the first line of all the project units you have
>
> {$I X:\Mypath\Example.Inc}
>
> Then by setting 'OPT_LowMem RELEASE_LITE' in the project options the
> precompiler
> will do
>     {$DEFINE OPT_LowMem}
>     {$DEFINE RELEASE_LITE}
>     {$DEFINE FLAG_NoRecordCache}
>     {$DEFINE FLAG_NoTexturedForms}
>     {$DEFINE FLAG_NoLinkMetaData}
>     {$DEFINE FLAG_SingleUser}
> for all units with the  '{$I X:\Mypath\Example.Inc}'.
>
> for all units without the include file the only defines will be
>     {$DEFINE OPT_LowMem}
>     {$DEFINE RELEASE_LITE}
>
> I hope this is clearer... When combined with commandline compilation (you
> can specify the
> project option as a commandline parameter) you can have a batchfile for each
> customer and
> quickly build any custom versions without a problem...
>
> --
> Aaron@home
>
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz



---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to