Search code examples
delphibuild-automationdelphi-xe2platformfile-io

Is it possible to configure the Build Configuration to automatically add suffixes for target platform?


is it possible to setup (ideally from GUI) the Build Configuration to automatically add suffixes to the output files according to the target platform ?

I mean, I will have for instance library project named Project and I would like to get

Project.dll - when I build the project for 32-bit platform
Project64.dll - when I build the project for 64-bit platform

Thank you


Solution

  • Funnily enough I was trying to do the exact same thing yesterday for the executable file of my app. I reached the conclusion that it is not possible to change the name of the output file. The only way you can influence the output file's name is with the {$E} directive but that just controls the extension of the output which is not what you want.

    Update

    Thanks to @TOndrej for pointing out the $LIBSUFFIX directive. This does not appear to be modifiable via the IDE project options for libraries, although there is such support for packages. However, it does indeed work when included in the source code of your package. Include this in your library .dpr file.

    {$IFDEF WIN64}
      {$LIBSUFFIX '64'}
    {$ENDIF}
    

    This does not have any effect for projects that produce executables (i.e. VCL apps, services etc.) and so I believe the only solution in those cases is a post-build action.