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?


  • Qt Champions 2016

    Hi Jakob!

    @Jakob said in How to compile only a minimum set of 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?

    No, you can build individual modules (bear in mind, here I mean qtbase, qt3d etc.) After you run configure, you can call make like this:

    $ make module-qtbase
    

    to build the base module for example.

    @Jakob said in How to compile only a minimum set of modules?:

    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 make install.

    Kind regards.



  • @kshegunov
    Thanx a lot for your answer - it makes a lot of sense. One question remains: will the install target know which individual modules I chose to build? Typically the install target is just a alias for all available installation targets, which would then recursively still build everything.


  • Qt Champions 2016

    @Jakob said in How to compile only a minimum set of modules?:

    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 configure script. I'll check something and get back to you.


  • Qt Champions 2016

    @Jakob
    Yes, you're correct. However, you can install only the modules with:

    $ make module-<modulename>-install_targets
    

    I hope that helps.

    Kind regards.



  • @kshegunov Excellent, thanks a lot!


  • Qt Champions 2016

    You're welcome!



  • For future reference: the actual name of the installation targets are:

    $ make module-<modulename>-install_subtargets
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.