Now you can build Qt in Yocto as before the switch to LTS.
By default, meta-qt5 builds Qt5 as a set of dynamic libraries. If needed, you can change the Qt configuration so that static libraries are produced instead. Then your application is linked against the Qt5 static libraries and you can produce a single binary without additional dependencies to Qt libraries. You can enable a static build by adding a new option qt5-static
into the DISTRO_FEATURES
variable.
Because each Qt application includes all the required Qt libraries, builds can become overly large if you enable tests and examples for Qt modules. For this reason, you should disable the options ptest
from DISTRO_FEATURES
and tests
from PACKAGECONFIG
in QtBase's recipe. This ensures that tests are not built for the Qt modules.
If you build a QML application statically, you need to add qtdeclarative-native
as a dependency to your application's recipe. Other changes are not required.
You can build your own Qt application with meta-qt5 by inheriting the correct class to your application recipe. After setting the usual SRC_URI, DEPENDS and other common bitbake variables, use qmake5
if you have a qmake project:
or cmake_qt5
if you have a cmake project using Qt:
In case you need to give qmake additional arguments, you can use the EXTRA_QMAKEVARS_PRE
variable:
EXTRA_QMAKEVARS_PRE += "CONFIG+=extra-args"