Creating a recipe for a Qt application

From Yocto Project
Revision as of 17:17, 10 June 2013 by PaulEggleton (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Creating a recipe for a Qt application is usually fairly straightforward and not much different to creating a recipe for any other kind of application; there are a few things specific to Qt that are worth noting however. This page is intended to cover these specifics.

Selecting the appropriate class to inherit

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

inherit qt4x11

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

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"

Alternatively, if you want to be a bit more flexible you can add these for installation within your custom image recipe instead.

Example recipes

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