[Interest] Pre-compile system

Mathieu Slabbinck matty.slabbinck at gmail.com
Tue Feb 24 08:51:53 CET 2015


Hi,

I have a Qt project that uses an external library (linux).
The external lib is built statically from source each time using a shell script.
To include the lib in the project, I've created a .pri file that
defines libx like follows:
        libx.name = libx
        libx.target = $$PWD/libx_build/.libx.build
        libx.commands = cd $$PWD/ && ./build_libx.sh
        QMAKE_EXTRA_TARGETS += libx
        PRE_TARGETDEPS += $$PWD/libx_build/.libx.build

So the logical way to build is:
- compile libx (can take some time)
- compile app

The sequential build I've managed to get right with the use of the
subdirs template.
But, this system only works when only using one compile job at a time.
Using for example make -j 4 will start the libx compilation as the
first job and already start compiling the app itself in parallel.
Resulting in undefined references because libx is not fully built yet.

So my question here: how can I make a qt project that compiles libx
before starting on the app itself, disregarding multiple jobs.

Kr

Mathieu



More information about the Interest mailing list