PDA

View Full Version : Cross-platform, single .pro file in QT Creator?



ngoonee
1st December 2014, 15:57
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

anda_skoa
1st December 2014, 16:51
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,
_

ngoonee
1st December 2014, 22:07
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.

anda_skoa
2nd December 2014, 07:34
Ah.

You can make conditional sections.

Conditions can be test functions (http://qt-project.org/doc/qt-5/qmake-test-function-reference.html), platforms, compilers, etc.

For example


win32 {
LIBS += ...
}

triggers for Windows, any compiler, and


win32-msvc {
....
}

triggers for Windows, Microsoft's compiler only, while


gcc* {
}

triggers for GCC, any version, any platform, and so on.

Cheers,
_

ngoonee
2nd December 2014, 09:46
Thanks! That solves it =)