Is there any documentation for the .pro file?
-
My project works fine on Linux and MacOS, and now I'm working on Windows with it. This involves some quite different stuff to the other two platforms: file paths, for example, are weird in Windows.
Since I will expect to use the same .pro file for all three platforms, how can I separate them out?
The .pro file was originally created in Linux, with lines that appear to be platform-specific (preceded with "qnx: ", "win32: ", "unix: "), and that may be enough, but are there any others? Is there one for MacOS? And why "win32"? It appears to work with 64-bit Windows, but is there a "win64"?
I've looked for documentation on the .pro file, but I can't find any. Is there one? -
-
@rjmx I maintain several Qt GUI projects that use
qmake
and that target multiple OS platforms. I have been (mostly) pleased with an approach based onpri
files, which are intended to be referenced from apro
like so:!include($$top_srcdir/cross_platform.pri) { error() }
You can see a "Hello World" at the links below (which is quite big to be called Hello World, but is meant to be a mostly-minimal example of how a multi-library project can be supported simultaneously on: linux, windows, macOS, iOS, android).
https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/cross_platform.pri
https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/main_gui.pro#L8
As you will see in my code comments, I was initially inspired by https://www.toptal.com/qt/vital-guide-qmake
Important parting thought:
ALWAYS always always use the "error()" part of this, or else (unbelievably?) the line will fail silently, and you'll wonder why downstream compile/link actions are failing:
# the "error()" part is critical! Indispensable! !include($$top_srcdir/cross_platform.pri) { error() }
-
I just noticed I should also explain this:
$$top_srcdir
The "$$top_srcdir" works due to the existence of a
.qmake.conf
file at the top-level of the repository (side-by-side with the top.pro
)That was a tip I found here: https://wiki.qt.io/QMake-top-level-srcdir-and-builddir
-
@KH-219Design Thank you for that. That's going to be useful.
-
A aha_1980 has marked this topic as solved on