Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 908
Martin Reiner Avatar asked Dec 14 '11 16:12

Martin Reiner


2 Answers

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.

like image 112
David Heffernan Avatar answered Oct 09 '22 16:10

David Heffernan


You could also use a build event to rename the executable. In the post build event in project options, you could do something like this:

ren $(OUTPUTPATH) $(OUTPUTNAME)$(Platform).exe

That would give you something like:

ExampleProgramWin64.exe

or

ExampleProgramWin32.exe

It does mean that you can't debug it though, since the IDE doesn't know it's been renamed, so maybe doing a copy is more appropriate.

copy $(OUTPUTPATH) $(OUTPUTDIR)\$(OUTPUTNAME)$(Platform).exe
like image 39
Nat Avatar answered Oct 09 '22 14:10

Nat