I have some projects working on Seattle, that I wish to port to Berlin. To try to accomplish I copy the Seattle's project code to a new folder for Berlin.

I have some projects working on Seattle, that I wish to port to Berlin. To try to accomplish I copy the Seattle's project code to a new folder for Berlin.

I want to compile and obtain an exe and dcu separated for the release of delphi:

1) I use the "CompilerVersion" in the Project options-Delphi compiler-for the Output directory, Unit output directory settings:

Currently:
E:\code\CoolProject\OUT\$(Platform)\$(Config)
To:
E:\code\CoolProject\OUT\$(CompilerVersion)\$(Platform)\$(Config)
The compiler ignore the sub-folder for the "CompilerVersion"
-
I manage to use the {$CompilerVersion} in the dpr and it works:
{$IF CompilerVersion = 31}
something in '..\..\..\COMMONXE101\unit1.pas',
{$ELSE}
something in '..\..\..\COMMONXE10\unit1.pas',
{$IFEND}
FormX in 'FormX.pas' {Form1},
System.SysUtils
Thanks in advance

Comments

  1. How about you learn version control. You don't need to copy to a new folder before porting. You need to learn version control.

    ReplyDelete
  2. Currently I use only one unit but with ifdef's - depending from the case.
    For example:
    ...
    {$IFDEF VER230} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE2
    {$IFDEF VER240} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE3
    {$IFDEF VER250} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE4
    {$IFDEF VER260} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE5
    {$IFDEF VER270} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE6
    {$IFDEF VER280} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE7
    {$IFDEF VER290} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE8
    {$IFDEF VER300} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE10 - Seattle
    {$IFDEF VER310} {$DEFINE NEW_UNITS} {$ENDIF}// Delphi XE10.1 - Berlin
    ...
    uses
    {$IFDEF NEW_UNITS} Winapi.Windows, {$ELSE} Windows, {$ENDIF}
    ...
    Or
    ...
    var
    cRead : Cardinal;
    {$IFDEF VER150} myByteArray : TBytes; {$ENDIF}
    {$IFDEF VER220} myByteArray : TIdBytes; {$ENDIF} // Delphi XE
    {$IFDEF NEW_UNITS} myByteArray: TIdBytes; {$ENDIF}

    ReplyDelete
  3. CompilerVersion is only valid during compilation, but the output folder is set by the IDE or the build system. The compiler does not resolve any variables inside folder names given to it.
    You can use ProductVersion to distinguish between Delphi versions, although it has a different value than CompilerVersion.

    ReplyDelete
  4. You can use any variable defined in environment variables for composing the output path. If you miss one, add it

    ReplyDelete
  5. Oliver Münzberg I found this: "Environment Variables"
    http://docwiki.embarcadero.com/RADStudio/Seattle/en/Environment_Variables
    Reading rigth now...

    It works Thanks Oliver Münzberg. Using something like this :
    E:\code\CoolProject\OUT\$(Platform)$(Config)$(ProductVersion)

    The changes don't propagate on both "release" or "debug", even when edited on the "Project Options - All configurations - All platforms ", I need to rewrite for each "release & debug configurations"

    ReplyDelete

Post a Comment