half-ordered qmake subdirs for optimal compilation speed?
-
I have a qmake project consisting of multiple subprojects. Like this:
TEMPLATE= subdirs CONFIG += ordered SUBDIRS = commonlib proj1 proj2 projN
Every project is independent, but depends on the commonlib static library, so it has to be built first. Each subprojects' .pro file has:
LIBS += ../libs/libCommonLib.a PRE_TARGETDEPS += ../libs/libCommonLib.a
Because make can only build them one at a time (due to "ordered"), half my compilation time is spent without all 8 of my CPU cores. Sometimes it's using as little as 1 core for like 10 seconds as it builds the final file for preceding projects.
Is there a way to fix this?
-
@thierryhenry14 yes, don't use ordered!
rather use depends
-
Thanks J Hilk.
Unfortunately .depends is not supported on Qt 4.8, which is what this legacy project is made with. I would like to port it to Qt 5.15, but this could take some time as the embedded Linux it runs on is extremely ancient.
-
@thierryhenry14 thats unfortunate, but you nowhere states its a Qt 4 project :P
I do not know of a qt4 substitute for depends, maybe someone else can help here.
My suggestion/workaround would be:
give your commonlib a main.cpp and make it a "standalone project"then you can select it in QtCreator and build it first, and then build (unordered) the rest of your project. Use pre/post make to copy the static library around, if necessary
-
Hi,
You are making a mistake. Qt 4.8 already has support for depends. See the 4.8 SUBDIRS variable documentation.
-
@SGaist said in half-ordered qmake subdirs for optimal compilation speed?:
Hi,
You are making a mistake. Qt 4.8 already has support for depends. See the 4.8 SUBDIRS variable documentation.
Oops, I misunderstood the wiki saying "Qt 4.8.x does not support it at all ", it seems that applies only to Visual Studio. Thanks!