Results 1 to 7 of 7

Thread: Determining if compiling for 32 bit or 64 bit and compiler version.

  1. #1
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default 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?
    John

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Determining if compiling for 32 bit or 64 bit and compiler version.

    See this post!

  3. #3
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default 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.
    John

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default 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?

  5. The following user says thank you to Lykurg for this useful post:

    drescherjm (20th September 2010)

  6. #5
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default 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
    Last edited by drescherjm; 20th September 2010 at 21:41.
    John

  7. #6
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default 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
    John

  8. #7
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default 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..
    Last edited by drescherjm; 21st September 2010 at 01:18.
    John

Similar Threads

  1. Compiling & using Crypto++ with mingw version of Qt
    By FS Lover in forum Qt Programming
    Replies: 14
    Last Post: 16th January 2018, 12:29
  2. compiling Qt 4.4.3 with intel compiler in windows
    By hammer256 in forum Installation and Deployment
    Replies: 0
    Last Post: 13th February 2009, 22:33
  3. How to determine the compiler-version (GCC) ?
    By Comer352l in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2009, 20:55
  4. How to specify compiler version in project file
    By mdecandia in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2007, 12:03
  5. Compiling custom Qt3 Widgets Gives warning in VC++6 Compiler
    By sunil.thaha in forum Qt Programming
    Replies: 4
    Last Post: 9th June 2006, 13:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.