Results 1 to 5 of 5

Thread: Cross-platform, single .pro file in QT Creator?

  1. #1
    Join Date
    Nov 2014
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Cross-platform, single .pro file in QT Creator?

    Similar question to [1]

    I've developed (halfway through) an app in Linux which will also need to be deployed in Windows. I have a Windows VM, and am currently struggling through the compilation of opencv (which I use in my app). Any modifications I can make to my .pro file so that i don't need to maintain two copies of it, one for each OS?

    [1] - http://qt-project.org/forums/viewthread/31873

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cross-platform, single .pro file in QT Creator?

    qmake was specifically designed to use the same .pro file across platforms.

    The thread you link to is about a different question, about running two instances of QtCreator in parallel on the same files but with different configurations.

    Cheers,
    _

  3. #3
    Join Date
    Nov 2014
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cross-platform, single .pro file in QT Creator?

    But things like setting LIBS etc. - aren't the paths different on Windows than on Linux (where everything is /usr/lib)? Because the guides I see to using opencv, for example, involve hard-coding the Windows path in the .pro file.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cross-platform, single .pro file in QT Creator?

    Ah.

    You can make conditional sections.

    Conditions can be test functions, platforms, compilers, etc.

    For example
    Qt Code:
    1. win32 {
    2. LIBS += ...
    3. }
    To copy to clipboard, switch view to plain text mode 
    triggers for Windows, any compiler, and
    Qt Code:
    1. win32-msvc {
    2. ....
    3. }
    To copy to clipboard, switch view to plain text mode 
    triggers for Windows, Microsoft's compiler only, while
    Qt Code:
    1. gcc* {
    2. }
    To copy to clipboard, switch view to plain text mode 
    triggers for GCC, any version, any platform, and so on.

    Cheers,
    _

  5. #5
    Join Date
    Nov 2014
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cross-platform, single .pro file in QT Creator?

    Thanks! That solves it =)

Similar Threads

  1. Replies: 1
    Last Post: 16th March 2013, 08:48
  2. Replies: 1
    Last Post: 11th November 2010, 00:31
  3. Cross-platform GUI app
    By rockballad in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2010, 07:38
  4. Qt's Cross-Platform Functionality
    By winston2020 in forum Qt Programming
    Replies: 3
    Last Post: 18th January 2009, 18:31
  5. QT Creator, cross platform program.
    By kazek3018 in forum Newbie
    Replies: 8
    Last Post: 20th December 2008, 23:13

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.