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]
QtWS25 Last Chance

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.5k 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.
  • K Offline
    K Offline
    Karen Morrissey
    wrote on 21 Sept 2015, 15:30 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Sept 2015, 21:53 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

      K 1 Reply Last reply 22 Sept 2015, 23:03
      0
      • P Offline
        P Offline
        Paul H.
        wrote on 21 Sept 2015, 22:01 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 21 Sept 2015, 22:03 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

          P 1 Reply Last reply 21 Sept 2015, 22:05
          0
          • S SGaist
            21 Sept 2015, 22:03

            QMAKE_TARGET is not part of Qt 4

            P Offline
            P Offline
            Paul H.
            wrote on 21 Sept 2015, 22:05 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
            • S SGaist
              21 Sept 2015, 21:53

              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

              K Offline
              K Offline
              Karen Morrissey
              wrote on 22 Sept 2015, 23:03 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 22 Sept 2015, 23:43 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
                • K Offline
                  K Offline
                  Karen Morrissey
                  wrote on 24 Sept 2015, 16:11 last edited by
                  #8

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

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 24 Sept 2015, 20:29 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

                    K 1 Reply Last reply 24 Sept 2015, 20:40
                    0
                    • S SGaist
                      24 Sept 2015, 20:29

                      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.

                      K Offline
                      K Offline
                      Karen Morrissey
                      wrote on 24 Sept 2015, 20:40 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
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 24 Sept 2015, 20:51 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

                        K 1 Reply Last reply 24 Sept 2015, 21:04
                        0
                        • S SGaist
                          24 Sept 2015, 20:51

                          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.

                          K Offline
                          K Offline
                          Karen Morrissey
                          wrote on 24 Sept 2015, 21:04 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

                          1/12

                          21 Sept 2015, 15:30

                          • Login

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