Determining if compiling for 32 bit or 64 bit and compiler version.
In CMake I have a library naming convention that includes the compiler version and x86 or x86_64 depending on if the build is a 32 or 64 bit. I am trying to do this with qmake so that I can integrate qwt into my build process cleanly. Is this possible?
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
Thanks for the suggestion. That however does not work for me. I need it to work under windows and also determine if the build is 64 bit not the OS. I always build using a 64 bit OS but most of the builds will be 32 bit applications using visual studio. When building from a 32 bit visual studio command prompt qmake generates a 32 bit build. When building from a 64 bit visual studio command prompt qmake generates a 64 bit build. I believe the difference between these are set in environment variables.
Now when I think about it I will look at the differences between the two command prompts because I should be able to tell which environment variable controls this and query that instead and use a procedure similar to your example.
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
You can also use QMAKE_HOST.arch to determine on what architecture you currently run. Or if you define which one to use, can't you use the scope parameter -32 or -64?
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
Excellent. That solves the issue.. I added message($$QMAKE_HOST.arch) to the pri file and got the expected output in the 32 and 64 bit command prompts.
X:\64Bit\VC.90\Test\qwt-5.2.1>qmake -r x:\QMakeBased\Libraries\qwt-5.2.1\qwt.pr
o
Project MESSAGE: x86_64
Reading X:/QMakeBased/Libraries/qwt-5.2.1/src/src.pro [X:/64Bit/VC.90/Test/qwt-5
.2.1/src]
Project MESSAGE: x86_64
Project MESSAGE: x86_64
Project MESSAGE: x86_64
x:\32Bit\VC.90\Temp\Qwt-5.2.1>qmake -r x:\QMakeBased\Libraries\qwt-5.2.1\qwt.pro
Project MESSAGE: x86
Reading X:/QMakeBased/Libraries/qwt-5.2.1/src/src.pro [X:/32Bit/VC.90/Temp/Qwt-5.2.1/src]
Project MESSAGE: x86
Project MESSAGE: x86
Project MESSAGE: x86
Reading X:/QMakeBased/Libraries/qwt-5.2.1/textengines/textengines.pro [X:/32Bit/VC.90/Temp/Qwt-5.2.
/textengines]
Project MESSAGE: x86
Reading X:/QMakeBased/Libraries/qwt-5.2.1/designer/designer.pro [X:/32Bit/VC.90/Temp/Qwt-5.2.1/desi
ner]
Project MESSAGE: x86
Project MESSAGE: x86
Project MESSAGE: x86
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
The following link helps as well. Since I want to append a suffix if I am running under x86_64.
http://developer.qt.nokia.com/faq/an...bit_or_a_64_bi
Re: Determining if compiling for 32 bit or 64 bit and compiler version.
Thanks again.
I got it working the way I wanted with the following code:
DEBUG_SUFFIX =
RELEASE_SUFFIX =
COMPILER_STR =
ARCH_STR =
win32-msvc2008 {
COMPILER_STR = _2008
}
win32-msvc2005 {
COMPILER_STR = _2005
}
win32 {
contains(QMAKE_HOST.arch, x86_64):{
ARCH_STR = _x64
}
DEBUG_SUFFIX = _$${COMPILER_STR}$${ARCH_STR}_d
RELEASE_SUFFIX = _$${COMPILER_STR}$${ARCH_STR}_
}
Now I can update my cmake qwt finder to use the naming convention (similar to what I use in CMake).
BTW, the reason for this is I build in both 32 and 64 bit versions and 2 compilers. With this naming scheme I can have 1 lib folder for each project as part of the install and not worry about the 64 bit version trashing the 32 bit version. I hope I explained that well enough..