Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I control the EXE name based on the target platform?

Tags:

build

exe

delphi

I'd like to have two different exe files, depending on whether it's 32-bit or 64-bit build, e.g., FooBar32.exe and FooBar64.exe. Is there a way to set this or is this going to be a postbuild action?

like image 223
Mike Stephenson Avatar asked Nov 10 '14 03:11

Mike Stephenson


People also ask

What is exe name?

.exe is a common filename extension denoting an executable file (the main execution point of a computer program) for Microsoft Windows.

Is .exe a file name?

An .exe is a very common file type. The .exe file extension is short for “executable.” These files are most commonly used on Windows® computers to install or run software applications.


2 Answers

In Project options under the Application tab there is a setting to change the target file extension. You can use this to change the name of executable of your project for different platforms.
NOTE: This only extends the default name that would be created (project name + Target file extension)

enter image description here

EDIT: As you can see this approach has one drawback and that is that it always add a dot in between the Project name and Target file extension.

But to be honest I rather follow the approach where I configure Delphi to output 32 bit executables in Bin32 and 64 bil executables into Bin64 folder instead of even renaming the main executable. Why?

If your application is using any external dynamic link libraries (dll's) you need to make sure to have them for each suported platform (32 bit executables require 32 bit dll's, while 64 bit executables require 64 bit dll's).

So if you store all these dll's in a single folder you will have to make sure that they are properly named (all 32 bit dll's would have 32 prefix and all 64 bit dll's would have 64 prefix). But that also means that in your code you would need to have specific entries for importing functions from these dll's (one for 32 bit dll and one for 64 bit dll). And that can realy complicate everything.

So making seperate bin folders for 32 bit and 64 bit application versions alows you to have dll's for 32 bit and 64 bit applications with the same names and therefore no need to make any changes in your source code to be able to handle with 32 bit and 64 bit dll's

like image 89
SilverWarior Avatar answered Sep 22 '22 14:09

SilverWarior


Not exactly what you need, but may be it helps:

{$IFDEF WIN32}
{$EXTENSION 32.exe}
{$ENDIF}

{$IFDEF WIN64}
{$EXTENSION 64.exe}
{$ENDIF}

So, your executables will be Foobar.32.exe and Foobar.64.exe (with two dots).

like image 33
vladon Avatar answered Sep 25 '22 14:09

vladon