Results 1 to 5 of 5

Thread: project file for 64 and 32 bit under linux

  1. #1
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default project file for 64 and 32 bit under linux

    hi everyone,

    i have two separate libraries for 32 bit and 64 bit. now i want to check in the project file, if the system is a 32 oder 64 bit system in order to use the correct library.

    i am using ubuntu 10.04, Qt version 4.6.2 and i have the following part in my .pro file:

    if(getconf LONG_BIT == 64) { #64 bit libs
    INCLUDEPATH += x_i
    LIBS += -L../x
    }
    else { #32 bit libs
    INCLUDEPATH += y_i
    LIBS += -L../y
    }

    "getconf LONG_BIT == 64" does not seem to work, is there a better way to solve this or is there something wrong with this line?

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

    Default Re: project file for 64 and 32 bit under linux

    I am not 100% sure, but I guess you have to wrap your getconf command inside the system function. Something like
    Qt Code:
    1. if( system(getconf LONG_BIT) == 64) {
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: project file for 64 and 32 bit under linux

    ... or you can use the mkspecs
    Qt Code:
    1. linux-g++-32
    2. {}
    3. linux-g++-64
    4. {}
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: project file for 64 and 32 bit under linux

    Quote Originally Posted by Lykurg View Post
    I am not 100% sure, but I guess you have to wrap your getconf command inside the system function. Something like
    Qt Code:
    1. if( system(getconf LONG_BIT) == 64) {
    To copy to clipboard, switch view to plain text mode 
    that did not work, about the mkspecs: i can not compile any files, i have to include either the 64 bit or the 32 bit libraries. or what did you mean with the mkspecs?

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

    Default Re: project file for 64 and 32 bit under linux

    Ok, I read the docs for you:
    Qt Code:
    1. BITSIZE = $$system(getconf LONG_BIT)
    2. if (contains(BITSIZE, 64)) {
    3. message($$BITSIZE)
    4. }
    5. if (contains(BITSIZE, 32)) {
    6. message($$BITSIZE)
    7. }
    8.  
    9. linux-g++ {
    10. message(On Linux)
    11. }
    12. macx-g++ {
    13. message(On Mac)
    14. }
    To copy to clipboard, switch view to plain text mode 
    for
    qmake -spec macx-g++ test.pro
    it outputs
    Project MESSAGE: 64
    Project MESSAGE: On Mac

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

    harakiri (20th July 2010)

Similar Threads

  1. Replies: 1
    Last Post: 3rd December 2009, 23:34
  2. Transvering project betwen Linux and Windows
    By frenk_castle in forum Newbie
    Replies: 3
    Last Post: 22nd November 2009, 11:34
  3. Compiling Linux project on Mac
    By December in forum Newbie
    Replies: 2
    Last Post: 25th March 2007, 04:25
  4. Project generation on linux from QT Project
    By darpan in forum Qt Programming
    Replies: 6
    Last Post: 11th December 2006, 09:43
  5. Project won't compile under Windows (works under Linux)
    By philski in forum Qt Programming
    Replies: 7
    Last Post: 14th September 2006, 15:29

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.