Using QMAKE to create 32 and 64-bit versions of a project

I need to create a 32-bit version of my application, but I am compiling it on a 64-bit OS. I am looking for a way to get QMake to generate both 32 and 64 bit 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 get in touch with the generated makefile.

+7
qt 32bit-64bit qmake
source share
2 answers

Use a construct 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 another architecture.

+8
source share

Use win32: before each command that you want to run for win32 architecture only. Or you can use the scope as

 win32 { SOURCES += paintwidget_win.cpp } 

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

+2
source share

All Articles