in scopes, how do I specify 64-bit Windows? [SOLVED]
-
I'm working with Qt 4.7.5 and Visual Studio 2005 and am starting to use QtCreator and qmake. I've looked at the OS/compiler specifications in mkspecs, and I don't see how to specify a 64-bit vs. 32-bit build so that I can reference the appropriate 3rd-party libraries. I also don't see mention of this in the documentation. Anyone know how to specify 32- vs. 64-bit for Windows in a scope?
-
Hi,
With such an old version of Qt, one way to do it is to add the information e.g. to CONFIG so you can add
CONFIG += x86_64
and useCONFIG(x86_64) { // 64bit stuff }
Hope it helps
-
Edit: THIS DOES NOT WORK FOR QT 4.
I can't find where this is documented, or remember where I got if from, but here is an example that I use:
# Determine 32 / 64 bit and debug / release build !contains(QMAKE_TARGET.arch, x86_64) { CONFIG(debug, debug|release) { message("Debug 32 build") } else { message("Release 32 build") } } else { CONFIG(debug, debug|release) { message("Debug 64 build") } else { message("Release 64 build") } }
In this example I am checking that it is not x86_64, and assuming x86 if it is not, which works for me. Hopefully this will help get you going.
-
QMAKE_TARGET is not part of Qt 4
-
From the qmake point of view ( at for least Qt 4 versions ) there is no difference between 64 and 32 bit compiler.
All difference is hidden in the environment settings.
So you have a choice either:- to hide your own dependencies behind the environment.
- or introduce additional configuration variables like suggested by SGaist.
One of the reasons I do not use QMake and QtCreator on Windows.
-
Specifically, what I'm trying to handle is 3rd-party library dependencies.
-
That's why I'm suggesting to add that to CONFIG.
CONFIG(x86_64) { // 64 bit path } else { // 32 bit path } LIBS += -lmylib
Don't forget that on windows you might even have to distinguish between Visual Studio versions depending on what you need as 3rd party libraries.
-
@SGaist said:
That's why I'm suggesting to add that to CONFIG.
CONFIG(x86_64) { // 64 bit path } else { // 32 bit path } LIBS += -lmylib
Don't forget that on windows you might even have to distinguish between Visual Studio versions depending on what you need as 3rd party libraries.
If I'm understanding you properly, I'll need to "throw a switch" using, say, automation to add
CONFIG += x86_64
or not to my sub-projects based on whether I want to build 64-bit or 32-bit. That is, to enable or disablex86_64
I need in some way to alter my sub-projects in advance of a build. Could even be with a .pri file. Do I understand correctly? -
You generally build a project for one architecture so you would do:
qmake CONFIG+=x86_64
So your project will be configured for x86_64. You then only need to implement the switch where needed.
You can add the
CONFIG += x86_64
as additional qmake argument in Qt Creator.