Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. #ifdef'ing between Desktop and Device builds
Forum Updated to NodeBB v4.3 + New Features

#ifdef'ing between Desktop and Device builds

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 3.5k 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.
  • M Offline
    M Offline
    matti-
    wrote on last edited by
    #1

    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
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      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
      0
      • M Offline
        M Offline
        matti-
        wrote on last edited by
        #3

        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
        0

        • Login

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