Creating a recipe for a Qt application

From Yocto Project
Revision as of 16:29, 15 May 2013 by PaulEggleton (talk | contribs) (Add instructional page on creating a recipe for a Qt app)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Selecting the appropriate class to inherit

If you wish to build against Qt/X11, you should add the following:

inherit qt4x11

Alternatively, for Qt/Embedded (i.e. for framebuffer/DirectFB output):

inherit qt4e

This will set up the appropriate build-time dependencies for your application.

Running qmake

qmake_base.bbclass, which both qt4x11 and qt4e inherit, will run qmake automatically as part of the normal do_configure step.

If you need to set any configuration variables or pass any options to qmake, you can add these to the EXTRA_QMAKEVARS_PRE or EXTRA_QMAKEVARS_POST variables, depending on whether the arguments need to be before or after the .pro file list on the command line respectively.

By default, all .pro files will be built. If you want to specify your own subset of .pro files to be built, specify them in the QMAKE_PROFILES variable.

Dependencies

The build system's normal shared library dependency generation will take care of setting up runtime dependencies such that all of the appropriate Qt libraries needed by your application will be installed alongside it. However, if your application requires other Qt components that are not directly linked to your application (such as Qt image plugins) then you will need to add these dependencies within the recipe, for example:

RRECOMMENDS_${PN} += "qt4-plugin-imageformat-jpeg qt4-plugin-imageformat-tiff"

Example recipes

There are example Qt application recipes in OE-Core under meta/recipes-qt/qt-apps/.