Raphael
Raphael

Reputation: 8192

Using QMAKE to build a both 32 and 64 bits versions of project

I need to generate a 32 bits version of my application however I am compiling on a 64 bits OS. I'm looking for a way to make QMake to generate both 32 and 64 bits versions of my application. If this is not possible I would like to know how to switch to 32 bits. I would also like to avoid having to mess with the generated makefile.

Upvotes: 8

Views: 13176

Answers (2)

kiriloff
kiriloff

Reputation: 26333

Make use of win32: in front of each command you would like be run for win32 architecture only. Or can use a scope as

win32 {
     SOURCES += paintwidget_win.cpp
 }

Also, you may refer to the architecture win32 or x64 with the ($Platform) MSDN macro for Visual Studio.

Upvotes: 2

PiedPiper
PiedPiper

Reputation: 5785

Use a construction something like:

CONFIG += 32bit

CONFIG(32bit) {
    TARGET = 32bit_binary
    QMAKE_CXXFLAGS += -m32
    LIBS += -L<path to 32bit libraries>
}
CONFIG(64bit) {
    TARGET = 64bit_binary
}

in your .pro file. Then you only need to change one line to recompile for the other architecture.

Upvotes: 8

Related Questions