Results 1 to 5 of 5

Thread: Multiple build configurations with qmake

  1. #1
    Join Date
    Oct 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Multiple build configurations with qmake

    Hello,

    i'm looking into possible build systems for a rather large project. Since we're using Qt for GUI and some other things, we're considering qmake.

    One problem i couldn't yet solve is that we have several build configurations, each of which has certain features enabled or disabled, like this:
    • debug_basic
    • release_basic
    • debug_more_features
    • release_more_features
    • debug_all_features
    • release_all_featuers

    The differences in those configurations are mostly preprocessor directives and some libraries that have to be linked, or not.
    In the end, we'd like to have qmake generate Visual Studio and XCode projects and, for Linux, Makefiles that have these targets.

    From the qmake docs, i could only see that it's possible to create debug and release targets.
    Is there a way to extend the list of targets?

    Greetings,

    DasHannes

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple build configurations with qmake

    Sure.
    qmake Code:
    1. debug_basic {
    2. # ...
    3. }
    4.  
    5. release_basic {
    6. # ...
    7. }
    To copy to clipboard, switch view to plain text mode 

    And then call qmake CONFIG+=debug_basic.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    DasHannes (10th October 2011)

  4. #3
    Join Date
    Oct 2011
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple build configurations with qmake

    With your suggestion, i would have to call qmake to generate a separate vcproj file for each configuration, is that correct?
    What i was hoping to achieve is calling qmake once, and then having

    • on a windows machine one .vcproj with 6 different build configurations
    • on a mac one xcode project with 6 different build configurations
    • on a linux box: a Makefile with 6 different targets


    Is that possible?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple build configurations with qmake

    I have no idea, very unlikely. Even for debug and release you have two separate Makefiles on Windows and Linux. When using Makefiles you could have one (manually written or autogenerated) Makefile contain references to all other makefiles but for other generators, I doubt it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Apr 2012
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple build configurations with qmake

    This may be a little late coming, but for completeness I'll share the best answer I was able to come up with.

    I've resorted to using the following QMake conditions:

    CONFIG(DebugBuild):message(">>>> Debug build")
    CONFIG(ReleaseBuild):message(">>>> Release build")


    These values are present both within Visual Studio and QtCreator using the Visual Studio compiler tool chain. "Debug" and "Release" with leading capitals may also work.

    Unfortunately it looks like these CONFIG values are not present on other platforms (I tried OSX, under QtCreator). For non-Visual Studio platforms you may be able to find something usable by printing the CONFIG variable value, like so:

    message("CONFIG: $${CONFIG}")

Similar Threads

  1. Replies: 1
    Last Post: 17th May 2011, 16:12
  2. build lib and dll with qmake
    By jh in forum Qt Programming
    Replies: 15
    Last Post: 17th August 2010, 21:10
  3. Multiple Qt configurations in my machine.
    By Diegol in forum Installation and Deployment
    Replies: 2
    Last Post: 2nd February 2010, 04:50
  4. Is it possible to build qmake without Qt?
    By xylosper in forum Qt Programming
    Replies: 2
    Last Post: 19th October 2009, 15:49
  5. Using qmake to build multiple apps and libs
    By marchand in forum Newbie
    Replies: 2
    Last Post: 12th June 2006, 17:33

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.