Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. in scopes, how do I specify 64-bit Windows? [SOLVED]

in scopes, how do I specify 64-bit Windows? [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
32 bits64 bitswin32qmake
12 Posts 4 Posters 8.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Karen MorrisseyK Offline
    Karen MorrisseyK Offline
    Karen Morrissey
    wrote on last edited by Karen Morrissey
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 use

      CONFIG(x86_64) {
      // 64bit stuff
      }
      

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Karen MorrisseyK 1 Reply Last reply
      0
      • Paul H.P Offline
        Paul H.P Offline
        Paul H.
        wrote on last edited by Paul H.
        #3

        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.

        1 Reply Last reply
        1
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          QMAKE_TARGET is not part of Qt 4

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Paul H.P 1 Reply Last reply
          0
          • SGaistS SGaist

            QMAKE_TARGET is not part of Qt 4

            Paul H.P Offline
            Paul H.P Offline
            Paul H.
            wrote on last edited by
            #5

            @SGaist I was just getting ready to edit my answer to say I wasn't sure if it was available in Qt 4. Thanks!

            1 Reply Last reply
            0
            • SGaistS SGaist

              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 use

              CONFIG(x86_64) {
              // 64bit stuff
              }
              

              Hope it helps

              Karen MorrisseyK Offline
              Karen MorrisseyK Offline
              Karen Morrissey
              wrote on last edited by
              #6

              @SGaist That doesn't solve the problem. That only hard-codes a platform. Am I running into this problem because at the time of Qt 4.7.5 they didn't consider one might need to build both 32- and 64-bit Windows apps?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                alex_malyu
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • Karen MorrisseyK Offline
                  Karen MorrisseyK Offline
                  Karen Morrissey
                  wrote on last edited by
                  #8

                  Specifically, what I'm trying to handle is 3rd-party library dependencies.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    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.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Karen MorrisseyK 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      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.

                      Karen MorrisseyK Offline
                      Karen MorrisseyK Offline
                      Karen Morrissey
                      wrote on last edited by
                      #10

                      @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 disable x86_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?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        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.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        Karen MorrisseyK 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          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.

                          Karen MorrisseyK Offline
                          Karen MorrisseyK Offline
                          Karen Morrissey
                          wrote on last edited by
                          #12

                          @SGaist Oh, I see where to do that. Thanks. I think that last part makes for a solution.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved