Much like Autotools and CMake, QMake is a build-script generator
designed by the developers of Qt. In its simplest form, Spack’s
QMakePackage runs the following steps:
$ qmake $ make $ make check # optional $ make install
QMake does not appear to have a standardized way of specifying
the installation directory, so you may have to set environment
variables or edit
*.pro files to get things working properly.
QMakePackage base class comes with the following phases:
qmake- generate Makefiles
build- build the project
install- install the project
By default, these phases run:
$ qmake $ make $ make install
Any of these phases can be overridden in your package as necessary.
There is also a
check method that looks for a
in the Makefile. If a
check target exists and the user runs:
$ spack install --test=root <qmake-package>
Spack will run
make check after the build phase.
Packages that use the QMake build system can be identified by the
presence of a
<project-name>.pro file. This file declares things
like build instructions and dependencies.
One thing to look for is the
minQtVersion(5, 6, 0)
This means that Qt 5.6.0 is the earliest release that will work.
You should specify this in a
Build system dependencies¶
At the bare minimum, packages that use the QMake build system need a
qt dependency. Since this is always the case, the
base class already contains:
If you want to specify a particular version requirement, or need to
link to the
qt libraries, you can override this in your package:
Passing arguments to qmake¶
If you need to pass any arguments to the
qmake call, you can
qmake_args method like so:
def qmake_args(self): return ['-recursive']
This method can be used to pass flags as well as variables.
*.pro file in a sub-directory¶
*.pro file used to tell QMake how to build the package is
found in a sub-directory, you can tell Spack to run all phases in this
sub-directory by adding the following to the package:
build_directory = 'src'