Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 560
Raphael Avatar asked Dec 08 '10 01:12

Raphael


People also ask

What is the use of qmake?

The qmake tool helps simplify the build process for development projects across different platforms. It automates the generation of Makefiles so that only a few lines of information are needed to create each Makefile. You can use qmake for any software project, whether it is written with Qt or not.

How do I create a qmake file?

Makefile is a set of commands (similar to terminal commands) with variable names and targets to create object file and to remove them. In a single make file we can create multiple targets to compile and to remove object, binary files. You can compile your project (program) any number of times by using Makefile.

What is qmake command?

The qmake tool provides you with a project-oriented system for managing the build process for applications, libraries, and other components. This approach gives you control over the source files used, and allows each of the steps in the process to be described concisely, typically within a single file.

What is qmake file?

QMake is a build system that generates Makefiles for GNU Make or project build files for Microsoft Visual Studio. It is part of the Qt software framework by Trolltech. While it is commonly used to construct Qt-based software, any project can benefit from it.


1 Answers

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.

like image 175
PiedPiper Avatar answered Oct 12 '22 00:10

PiedPiper