How To Use Qt Embedded Linux with the Factory
Table of Contents
Qt can be easily integrated with the Timesys Factory to create powerful graphical applications. You can leverage existing tools, such as Qt Creator and cross-build your application using a toolchain built by Timesys, much like any other application. However, Qt employs a unique build tool of its own, qmake, which differs slightly from the standard autoconf/make method. This document is designed to help you to cross-build a Qt project and integrate it into the Timesys Factory.
Prerequisites
- Factory workorder with the following options enabled:
- TSWO_SOFTWARE_qt-embedded-linux=y (Target Software->Software Packages->Graphics->Toolkit->qt-embedded-linux in the menuconfig interface)
Generating a Cross-Toolchain containing Qt
Simply selecting qt-embedded-linux in your workorder is not sufficient for installing qt-embedded-linux to your host tools. It will only be included if another package in your workorder depends on it to build. Otherwise, it will only be installed to the target. There are two methods to installing qt-embedded-linux to your toolchain:
- Add a package that depends on qt-embedded-linux to build, such as qt-about-timesys.
- Build your workorder as usual on the command line or online.
- An installer will be generated, which you can then distribute to the application developers.
-or-
- Build your workorder as usual on the command line.
- Delete the final toolchain tarball:
rm build_*/toolchain-final*
- Run make qt-embedded-linux-host-install on the command line.
- Run make toolchain-final-package to generate the toolchain installer.
- Run make installer to generate the installer, which you can then distribute to the application developers.
Note: The last three steps can be done in one command, i.e. make qt-embedded-linux-host-install toolchain-final-package installer
Cross Building an Existing Qt Project on the Command Line
- Export your path to point to the cross-toolchain:
$ export PATH=/installdir/toolchain/fake/bin:/installdir/toolchain/bin:/installdir/toolchain/sbin:/installdir/toolchain/usr/bin:/installdir/toolchain/usr/sbin:$PATH
- In the root directory of your project, run cross_qmake, the -spec option pointing to the Timesys mkspec file will be included automatically when cross_qmake is used.
- Run cross_make to build the Qt project:
cross_make
- Run make install, with INSTALL_ROOT set to installation location. Please note that an INSTALLS variable should be set in the .pro file for this target to work.
make install INSTALL_ROOT=/targetinstalldir/
Adding the Qt Project to Factory
Qt packages can be added to the Factory just like any other package. Please see the document HackingTheFactory for more information.
Since the build process differs slightly from Autoconf-based packages, you will need to modify the Makefile for your project. See the package qt-about-timesys for an example.
Additional Information
Running a Qt Application
To run a Qt application on the command line, you must pass the -qws flag to the application. For example, to run qt-about-timesys, you would use the command:
/usr/bin/qt-about-timesys -qws
Qt Licensing
Qt is released under dual licensing: commercial and opensource. For more information about Qt licenses, please visit: Qt Licensing.
External Links
- Official Qt Site
- Qt Creator — Free Qt Application IDE.
- Qt Licensing — Information about the various Qt licenses.