Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Solved with alternative solution] Add subfolders with libraries and includes depending on processor bitness
QtWS25 Last Chance

[Solved with alternative solution] Add subfolders with libraries and includes depending on processor bitness

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 1.9k 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.
  • B Offline
    B Offline
    Bullub
    wrote on last edited by
    #1

    Hi all.

    I'm developing a medium Qt project. It has already a good bunch of files .h, .cpp, and .ui. All files are in same folder, and it's OK for me by now.

    My environment is Ubuntu 12.04 LTS, with Qt Creator 2.5.2, 64 bits.

    Now, I need to add some files to the project; those files differs on the target processor bitness.

    These files for x64 are:
    camboardnano.L64.pap
    camboardnanoproc.L64.ppp
    libpmdaccess2.so
    pmddatadescription.h
    pmdsdk2.h
    pmdsdk2common.h

    Files for x86 are:
    camboardnano.L32.pap
    camboardnanoproc.L32.ppp
    libpmdaccess2.so
    pmddatadescription.h
    pmdsdk2.h
    pmdsdk2common.h

    I'd like to add them in separate subfolders of the project's one: PMDSDK2_L64 and PMDSDK2_L32, and link them depending of the current processor.

    Googling or reading Qt's docu haven't suggested me any (simple) solution for this. How can I achieve it? What would be the best way to achieve this? (the idea is that if I copy this project to an 32 bits environment, I will be able to compile there with the right files previously added)

    Thanks in advance!

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

      Hi,
      The simplest I can think of is:
      @
      CONFIG(x86, x86|x86_64) {
      #32 bit stuff
      }

      CONFIG(x86_64, x86|x86_64) {
      #64 bit stuff
      }
      @

      CONFIG += "The arch you want to build" when you run qmake. You can add that to QtCreators build pan in Build Steps

      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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bullub
        wrote on last edited by
        #3

        Hmmmm...

        I will have to consider your aportation.

        What I have got so far by now is that my .pro file of the project must have (for a x64 fixed environment):

        @#Header and library in subfolders. $$PWD points to project folder
        LIBS += -L$$PWD/PMDSDK2_L64/ -lpmdaccess2
        INCLUDEPATH += $$PWD/PMDSDK2_L64
        DEPENDPATH += $$PWD/PMDSDK2_L64
        HEADERS += pmdsdk2.h@

        Now I will try to merge this with your apportation. Thanks, SGaist.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bullub
          wrote on last edited by
          #4

          [quote author="SGaist" date="1372421312"]Hi,
          The simplest I can think of is:
          @
          CONFIG(x86, x86|x86_64) {
          #32 bit stuff
          }

          CONFIG(x86_64, x86|x86_64) {
          #64 bit stuff
          }
          @

          CONFIG += "The arch you want to build" when you run qmake. You can add that to QtCreators build pan in Build Steps

          Hope it helps[/quote]

          This doesn't work. Perhaps that works in Windows, but it does'nt under LInux.

          This in .pro
          @CONFIG(x86, x86|x86_64)
          {
          #32 bit stuff
          message("Building 32 bits")
          }

          CONFIG(x86_64, x86|x86_64)
          {
          #64 bit stuff
          message("Building 64 bits")
          }@

          will output:
          @Project MESSAGE: Building 32 bits
          Project MESSAGE: Building 64 bits@

          I'm reading about CONFIG variables, specially $$QMAKE_HOST.arch, but
          @message($$QMAKE_HOST.arch)
          message(QMAKE_HOST.arch)
          message($$QMAKE_HOST)
          (same with QMAKE_TARGET) @
          prints nothing.

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

            QMAKE_HOST.arch seems to be broken on *nix (also observed it on OS X)

            You need to either run qmake with CONFIG=x86 to make the selection (until there's a fix for QMAKE_HOST.arch)

            @qmake CONFIG=x86@

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

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bullub
              wrote on last edited by
              #6

              The final solution I've applied is manually activate or deactivate libraries and folders depending of some manual variable defined in .pro file
              (look this post of mine: "[Solved] .pro file questions (custom variables, mkspecs and contains())":http://qt-project.org/forums/viewthread/29381/).

              So finally I will have something like this in my .pro file, setting manually the desired bitness:
              @
              PROCBITS = "64"
              message($$PROCBITS)
              contains( PROCBITS , 64 ){
              message("Including 64 bits libraries")
              LIBS += -L$$PWD/PMDSDK2_L64/ -lpmdaccess2
              INCLUDEPATH += $$PWD/PMDSDK2_L64
              DEPENDPATH += $$PWD/PMDSDK2_L64
              HEADERS += pmdsdk2.h
              }
              contains( PROCBITS , 32 ){
              message("Including 32 bits libraries")
              LIBS += -L$$PWD/PMDSDK2_L32/ -lpmdaccess2
              INCLUDEPATH += $$PWD/PMDSDK2_L32
              DEPENDPATH += $$PWD/PMDSDK2_L32
              HEADERS += pmdsdk2.h
              }
              @

              and the corresponding 64 bits libraries are in subfolders PMDSDK2_L32 and PMDSDK2_L64 in my project folder.

              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