Dependencies when using QMAKE_EXTRA_COMPILERS for code generation
-
I've been using the qmake project from here https://www.qt.io/blog/2018/06/06/building-bridge-qt-dds as a base for building our somewhat complex DDS based application library, and have run into a problem with multicore builds. My issue is that some of the IDLs used include others. This produces a dependency downstream where some of the resulting generated headers #include others. For single processor builds, this works fine; I just order the IDLs in the .pro file such that the included headers are already generated by the time we get to the headers that include them. However, for running parallel builds, I've been unable to find a way to prevent one header from including another that may not have finished generating by the time we get there. That puts a limit on the number of cores I can use for a build.
Is there a way to improve the dependency management in this example to cover this case? Failing that, is there a way to limit the number of cores passed to make's -j param in an individual .pro file so I can prevent this issue for IDL generation without slowing down the rest of our build? Or can I somehow force the IDL generation step to complete before the gcc part begins?
-
Hi and welcome to devnet,
One idea that comes to mind is to use the subdirs template so you can properly order things. Have one project dedicated to the generation of your IDL related files. Make it a dependency of your main project and so your main project will begin building after everything is generated.
-
Thanks for the reply, that makes sense. I could write a second project file that knows the names of all the generated files it's expecting to see (though it'd warn that they don't exist when qmake generates the makefile from it), and builds them, but I don't see how to have the gcc compile step not run against the output in the existing project. Apologies if it's a stupid question, but how would I turn that off in the generation project?
[EDIT] I figured it out. TEMPLATE = aux, and remove the ddsgen.variable_out line from each extra compiler definition. I think that's it working. Thanks for the help!
[EDIT] However, qmake is warning that it can't find the input files for the second, build, project since they don't exist when qmake is run to create the Makefiles for it. Is there any way to suppress that warning?