Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    #ifdef'ing between Desktop and Device builds

    Mobile and Embedded
    2
    3
    3227
    Loading More Posts
    • 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.
    • M
      matti- last edited by

      Hi, was wondering what's The way to do conditional compilation between Desktop and Device environments? I know there is Q_OS_LINUX but since I am developing on Ubuntu for Harmattan, I assume this would be defined for both :)

      Perhaps it's possible to #define a custom flag in the .pro file using unix: { } and the makespec somehow, anyone done this?

      • M

      Author of <a href="http://mmark.777-team.org/">MMark13</a>

      1 Reply Last reply Reply Quote 0
      • L
        lgeyer last edited by

        You will find a list of platform specific defines "here":http://doc.qt.nokia.com/latest/qtglobal.html#Q_OS_AIX.

        @
        // .pro
        contains(MEEGO_EDITION,harmattan) {
        DEFINES += BUILD_DEVICE
        } else {
        DEFINES += BUILD_DESKTOP
        }

        // .cpp
        #if defined(BUILD_DEVICE)
        ...
        #elif defined(BUILD_DESKTOP)
        ...
        #else
        #error Unsupported platform.
        #endif
        @

        1 Reply Last reply Reply Quote 0
        • M
          matti- last edited by

          Oh cheers. After playing around with this a while, I decided to try to go for something more generic:

          @win32|linux-g++|linux-g++-64 {
          DEFINES += BUILD_DESKTOP
          message(Desktop build)
          } else {
          DEFINES += BUILD_DEVICE
          message(Device build)
          }@

          • M

          Author of <a href="http://mmark.777-team.org/">MMark13</a>

          1 Reply Last reply Reply Quote 0
          • First post
            Last post