Results 1 to 5 of 5

Thread: To detect 32 bit or 64 bit platform in .pro file

  1. #1
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default To detect 32 bit or 64 bit platform in .pro file

    Hi,

    I am trying to create a project to be built on both 64 bit and 32 bit Linux/Windows environment.
    This is what I am doing to detect for architecture:

    contains(QMAKE_TARGET.arch, x86_64):{
    message( "Building for 64 bit")
    }

    !contains(QMAKE_TARGET.arch, x86_64):{
    message( "Building for 32 bit")
    }

    I am using 64 bit machine with RHEL6, but it always go in to 32 bit. It doesnt detect that I am on 64 bit machine.

    My qmake parameters are as follows:
    qmake Test.pro -r -spec linux-g++-64 CONFIG+=debug

    Am I doing anything wrong . Please suggest.
    Or is there any other way of doing this ???

    Thanks in advance for youe help.

    Regards,
    Raj

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: To detect 32 bit or 64 bit platform in .pro file

    Try:
    qmake Code:
    1. *-64 { ... }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: To detect 32 bit or 64 bit platform in .pro file

    I just realized from this following link that QMAKE_TARGET.arch needs to be set somwhere.

    http://developer.qt.nokia.com/faq/an...bit_or_a_64_bi

  4. #4
    Join Date
    Apr 2011
    Posts
    8
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: To detect 32 bit or 64 bit platform in .pro file

    How to set QMAKE_TARGET.arch? I have quite a problem telling win32 from win64.

  5. #5
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: To detect 32 bit or 64 bit platform in .pro file

    I set it in my Projects .pro file using an environment variable.

    QMAKE_TARGET.arch = $$(BUILD_PROJ)

    BUILD_PROJ can be set to x86_64 or x86 as envt variable.

Similar Threads

  1. Replies: 1
    Last Post: 11th November 2010, 00:31
  2. Replies: 2
    Last Post: 8th November 2010, 06:08
  3. Replies: 4
    Last Post: 3rd August 2010, 07:17
  4. How to detect if a file is being used?
    By richardander in forum Qt Programming
    Replies: 3
    Last Post: 11th June 2009, 19:30
  5. Detect platform where my QT4 program is running on
    By the_bis in forum Qt Programming
    Replies: 1
    Last Post: 14th September 2007, 12:01

Tags for this Thread

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.