How to use Qt Lite with Yocto

During the development cycle of 5.12 we've been working on making it easier to use Qt Lite in Yocto builds, especially those using our meta-boot2qt layer.

Qt Configuration Tool now has the ability to export the set of selected Qt Lite features into files that can be used by the Yocto build to build a slimmer Qt.

Qt Configuration Tool is commercial-only and allows you visually explore and toggle different optional parts of Qt after opening an initially configured source tree. It can be used directly to configure that source tree for builds that don't include features that you don't need. That configuration can also be exported into a single file that can imported later, which makes sharing the configuration between people easier.

Previously there however wasn't a clear path to using that in a Yocto-driven build, since meta-qt5 recipes build Qt module by module. New version 1.2 of the tool and the new qt5-features class in meta-boot2qt layer provide that. Both are available in Qt for Device Creation 5.12.

  1. Run ./configure for a qt5 source tree with the necessary options for your
    platform and choosing the commercial license.
  2. Open Qt Configuration Tool and select the build directory from the previous step.
  3. Select/unselect the features you want with the tool.
  4. When the configuration is ready, select "File" > "Export Features for
    Boot2Qt" and pick a folder. A feature file for each module that you've made
    changes to is created into that folder.
  5. In your yocto build, for each module that you have a feature file for:
    1. Create a new recipe extension for the module, e.g. "qtdeclarative_git.bbappend".
    2. Add the line "inherit qt5-features" into that bbappend file.
    3. Put the feature file for the module (e.g. "qtdeclarative.opt") into a
      features/ directory next to your bbappend file.

Then run your build (bitbake b2qt-embedded-qt5-image if you are basing your build on our example images) and enjoy the slimmer Qt made just for you!


Blog Topics:

Comments