Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to compile only a minimum set of modules?
I'm trying to compile Qt 5.6.1 from source, which I downloaded as a .zip. In our application we only use a small subset of the modules - to be precize, in our CMake-based infrastructure we have currently:
find_package(Qt5Core REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5OpenGL REQUIRED) find_package(Qt5Concurrent REQUIRED) find_package(Qt5Designer REQUIRED) find_package(Qt5Svg REQUIRED) find_package(Qt5Test REQUIRED) find_package(Qt5PrintSupport REQUIRED) find_package(Qt5Gui REQUIRED)
As far as I can tell, this only requires qtbase, qtsvg, and qttools (possibly some more, but I can't find easily how these package names map into module names).
According to http://doc.qt.io/qt-5/configure-options.html: 'it is possible to include or exclude particular Qt modules'. In other words: I expected to be able to tell the configure script to skip all modules, except the ones mentioned above. But the documentation then only mentions how to skip individual modules.
Am I really forced to write out a -skip module for every single module, except the ones I need, or is there some more efficient way to compile only what I need? Maybe I should just simply remove the folders from the base source folder?
Am I really forced to write out a -skip module for every single module, except the ones I need, or is there some more efficient way to compile only what I need?
No, you can build individual modules (bear in mind, here I mean qtbase, qt3d etc.) After you run configure, you can call
$ make module-qtbase
to build the base module for example.
Maybe I should just simply remove the folders from the base source folder?
No, don't do that. Just build whatever you need (as shown above) and install it ( into a prefixed location) with the usual
Thanx a lot for your answer - it makes a lot of sense. One question remains: will the
installtarget know which individual modules I chose to build? Typically the
installtarget is just a alias for all available installation targets, which would then recursively still build everything.
Typically the install target is just a alias for all available installation targets, which would then recursively still build everything.
Yes, you might be right about this. I often build "developers' build", so there's no install step, and you're probably right that it'll try to build the other modules. Hm. I don't know if you can request specific modules directly from the
configurescript. I'll check something and get back to you.
Yes, you're correct. However, you can install only the modules with:
$ make module-<modulename>-install_targets
I hope that helps.
@kshegunov Excellent, thanks a lot!
For future reference: the actual name of the installation targets are:
$ make module-<modulename>-install_subtargets