Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XE4: How to change exe output name base on platform?

Tags:

delphi

Simply I need output executable names like MyApp32.exe and MyApp64.exe after compiling my project in Delphi XE4.

I found a directive in the forum which is {$LIBSUFFIX '32'} but it seems it is only for dlls.

Any suggestions for executable files?

Thanks.

like image 498
Mehmet Fide Avatar asked May 10 '13 07:05

Mehmet Fide


3 Answers

The final executable filename always matches the project filename. So either create separate projects that share common source code, or else use a Post-Build event to invoke a script that copies and renames the output file to a separate deployment folder after it has been compiled, such as:

copy /B "$(OutputPath)" "C:\Deployment\$(OutputName)$(MySuffix)$(OutputExt)"

Where MySuffix is defined in the Project Options with a different value for each platform:

MySuffix=32

.

MySuffix=64

By using a separate folder, the debugger still has access to the original un-renamed executable for debugging and testing.

like image 198
Remy Lebeau Avatar answered Sep 25 '22 15:09

Remy Lebeau


Simple trick allow it:

Go to Project Settings->Application and in field "Target file extensions" add unique suffix for every configuration.

e.g

Debug 32 bit: debug32.exe  
Debug 64 bit: debug64.exe  
Release 32 bit: 32.exe  
Release 64 bit: 64.exe 

Output for project with name "ProjectName":

ProjectName.debug32.exe  
ProjectName.debug64.exe  
ProjectName.32.exe  
ProjectName.64.exe
like image 40
Allex Avatar answered Sep 24 '22 15:09

Allex


The way I handle this is that I have a single project with multiple targets: 32/64 bit, debug/release, etc. Each of those targets is output to a separate directory. For example, Win64\Release.

When I prepare the files needed for deployment and installation, I rename the executables at that point. And this renaming is needed because I deploy 32 and 64 bit versions to the same directory. Naturally this is all automated.

Remy's approach of renaming the output file as a post-build action has the downside that the debugger won't be able to locate an executable.

The philosophy is to fit in with the development environment when working with files that will be used by the IDE. But then when it comes to deployment, you are free to rename files, re-organise them into a different folder structure etc. that better suits your deployment needs.

like image 38
David Heffernan Avatar answered Sep 28 '22 15:09

David Heffernan