Results 1 to 4 of 4

Thread: How Does One Put a Conditional For Embedded Linux into a .pro file?

  1. #1
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How Does One Put a Conditional For Embedded Linux into a .pro file?

    Okay, in a .cpp file you can put the following:

    #ifdef Q_WS_QWS
    #endif

    to denote Embedded Linux. It seems you can't do this in a .pro file. I've got a couple of lines in the .pro file that I want to ignore when compiling/running the application on the desktop (Linux). They are:

    CONFIG += static
    LIBS+= -L../xxxxkbrdplugin/kbddrivers \
    -lxxxxkbrddriverplugin

    How does one put a conditional in the .pro file to ignore these lines when compiling to run on a Linux desktop? Thanks for the help.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How Does One Put a Conditional For Embedded Linux into a .pro file?

    Hi,

    you can use scopes with the name of the use makespec. Since I never have developed for embedded linux I don't know what is used but it is like:
    qmake Code:
    1. linux-g++ {
    2. # Linux stuff
    3. }
    4. macx-g++ {
    5. # mac stuff
    6. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How Does One Put a Conditional For Embedded Linux into a .pro file?

    ...or you can check your environment. E.g. you want to check if you are on a Mac-Darwin system:
    qmake Code:
    1. SYSNAME = $$system(uname)
    2. if (contains(SYSNAME, 'Darwin')) {
    3. message("Yes, you are on a Darwin system!")
    4. }
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to Lykurg for this useful post:

    cloaked_and_coastin (27th July 2010)

  5. #4
    Join Date
    Jan 2010
    Posts
    18
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How Does One Put a Conditional For Embedded Linux into a .pro file?

    I went into the qt-everywhere-opensource-src-4.6.0/mkspecs/qws (Since I'm running on Embedded Linux) directory and chose the applicable mkspec. I then changed my .pro file to this:

    linux-powerpc-g++ {
    CONFIG += static
    LIBS += -L../iviukbrdplugin/kbddrivers \
    -liviukbrddriverplugin
    }

    Now I'm able to compile for the desktop and for the target without having to comment stuff out in the .pro file. Thanks Again!

Similar Threads

  1. SDK 4.6 & Qt Embedded for Linux
    By zuck in forum Qt Programming
    Replies: 2
    Last Post: 21st December 2010, 14:56
  2. Replies: 2
    Last Post: 1st March 2010, 17:58
  3. Qt for linux OR Qt/Embedded??
    By GeorgeOfTheBush in forum Installation and Deployment
    Replies: 5
    Last Post: 15th May 2009, 09:35
  4. Multiple apps using Qt/Embedded+Qtopia on Embedded Linux
    By drahardja in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 17th February 2008, 21:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.