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. QMake - Architecture specific conditional compilation
Forum Updated to NodeBB v4.3 + New Features

QMake - Architecture specific conditional compilation

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 6.4k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jschmerge
    wrote on last edited by
    #1

    Hi, I'm wondering how I would conditionally include files in a project file, based on the architecture i'm building for. What I'd like to do is something like the following:

    @unix {
    SOURCES += a.cpp
    SOURCES += b.cpp

    LIBS += -lfoo

    x86 {
    SOURCES += c_x86.cpp
    LIBS += -lbar
    }
    arm {
    SOURCES += c_arm.cpp
    }
    }
    @

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      I'd try a scope with something like
      @
      contains(QMAKE_TARGET.arch, x86)
      @

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jschmerge
        wrote on last edited by
        #3

        Unfortunately, that does not seem to work.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Alexandr Ekimov
          wrote on last edited by
          #4

          @CONFIG+= arm11
          arm11 {@

          PS What means arm? arm7, arm9, arm11?

          Ekimov Alexander,
          http://www.ekimoff.com

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            Wait a minute, are we talking about the architecture you're (cross) compiling for or the host architecture?

            [quote author="Alexandr Ekimov" date="1313508331"]@CONFIG+= arm11
            arm11 {@

            PS What means arm? arm7, arm9, arm11?[/quote]

            The name of the specific ARM architecture.

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jschmerge
              wrote on last edited by
              #6

              My compilation host will likely always be x86 or x86_64, but I'm working on code that needs to be compiled for both x86 and ARM

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dangelog
                wrote on last edited by
                #7

                Ok. What do QMAKE_HOST.arch and QMAKE_TARGET.arch contain for your setup?

                Software Engineer
                KDAB (UK) Ltd., a KDAB Group company

                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