How to compile QT application

Moderators: Oren.R, fradensky

Ron.D
Posts: 151
Joined: Wed Dec 31, 2014 11:19 am

How to compile QT application

Postby Ron.D » Wed Jan 07, 2015 8:14 am

A simple cookbook to show how to compile an application with QT.
Will use one of the sample application as example.

1. Build tools
$ cd ~/yocto_varsomam33/tisdk/build
$ . conf/setenv
edit conf/local.conf and add to the bottom:
#
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug eclipse-debug"

$ export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux/bin:$PATH
$ MACHINE=varsomam33 bitbake meta-toolchain-qt5

2. install tools
arago-tmp-external-linaro-toolchain/deploy/sdk/arago-2014.12-toolchain-2014.12.sh
select /opt/qt5devtools/ as your target directory

3. sample application

$ cd ~/yocto_varsomam33
$ mkdir qtapps
$ cd qtapps
$ cp -a ../rootfs/usr/share/qt5/examples/opengl/hellowindow/ ./
$ cd hellowindow

$ export PATH=/opt/qt5devtools/sysroots/i686-arago-linux/usr/bin/qt5:$PATH$
Create new file qmake.conf:
#
CROSS_COMPILE = arm-linux-gnueabihf
ROOTFS = /opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi
#
QMAKE_CC = $CROSS_COMPILE-gcc
QMAKE_CXX = $CROSS_COMPILE-g++
QMAKE_LINK = $CROSS_COMPILE-g++
QMAKE_LINK_SHLIB = $CROSS_COMPILE-g++
QMAKE_AR = $CROSS_COMPILE-ar cr
QMAKE_OBJCOPY = $CROSS_COMPILE-objcopy
QMAKE_STRIP = $CROSS_COMPILE-strip
#
QMAKE_LFLAGS_RELEASE = -Wl,-O1,-rpath $ROOTFS/usr/lib
#
QMAKE_INCDIR = $ROOTFS/usr/include
QMAKE_LIBDIR = $ROOTFS/usr/lib
QMAKE_INCDIR_X11 = $ROOTFS/usr/include
QMAKE_LIBDIR_X11 = $ROOTFS/usr/lib
QMAKE_INCDIR_OPENGL = $ROOTFS/usr/include
QMAKE_LIBDIR_OPENGL = $ROOTFS/usr/lib
#

$ qmake
edit the genreated Makefile and insert in the top
CROSS_COMPILE = arm-linux-gnueabihf
ROOTFS = /opt/qt5devtools/sysroots/cortexa8t2hf-vfp-neon-oe-linux-gnueabi
#
OE_QMAKE_CC = $(CROSS_COMPILE)-gcc
OE_QMAKE_CXX = $(CROSS_COMPILE)-g++
OE_QMAKE_LINK = $(CROSS_COMPILE)-g++
OE_QMAKE_LINK_SHLIB = $(CROSS_COMPILE)-g++
OE_QMAKE_AR = $(CROSS_COMPILE)-ar cr
OE_QMAKE_OBJCOPY = $(CROSS_COMPILE)-objcopy
OE_QMAKE_STRIP = $(CROSS_COMPILE)-strip

ADD to the INCPATH and LIB --sysroot=/home/variscite/yocto_varsomam33/tisdk/build/arago-tmp-external-linaro-toolchain/sysroots/varsomam33
change the /home/variscite to your home directory.

$ make clean
$ make
copy the hellowindow toyour target and run it
./hellowindow --platform eglfs

Return to “Yocto”

Who is online

Users browsing this forum: No registered users and 1 guest

cron