summaryrefslogtreecommitdiffstats
path: root/recipes-qt
diff options
context:
space:
mode:
authorEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-05-13 15:44:02 +0200
committerEirik Aavitsland <eirik.aavitsland@theqtcompany.com>2015-05-28 14:13:39 +0300
commite8067960ac419c9a47824fa996283d31faa9c309 (patch)
tree2527ba7b8be52be88a2e45dd785100156a1930e5 /recipes-qt
parent10c6c4ef744ca122f976be1d4f68713cafc01730 (diff)
downloadmeta-boot2qt-e8067960ac419c9a47824fa996283d31faa9c309.tar.gz
Toolchain: add static device mkspec, suitable for Qt Creator
The linux-oe-g++ mkspec used by meta-qt5 depends on the user sourcing the toolchain environment-setup script, which modifies the PATH and sets a long range of environment variables. That is not a "best practice" way of use Qt, and does not allow smooth integration of the toolchain into Qt Creator. Here, we instead create a static mkspec for the toolchain: devices/linux-oe-generic-g++. The toolchain recipe will will the qdevice.pri file with the required compiler flags etc. for the target. Additionally, we introduce an extra .pri file for device-specific settings, so they can be shared between the two mkspecs. Change-Id: Ie5a019524ba6cdddffb71b0c7c28861ddba17fbd Reviewed-by: Samuli Piippo <samuli.piippo@theqtcompany.com>
Diffstat (limited to 'recipes-qt')
-rw-r--r--recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb39
-rw-r--r--recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qmake.conf14
-rw-r--r--recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qplatformdefs.h2
-rw-r--r--recipes-qt/qt5/qtbase/emulator/oe-device-extra.pri2
-rw-r--r--recipes-qt/qt5/qtbase/mx6/oe-device-extra.pri8
-rw-r--r--recipes-qt/qt5/qtbase/oe-device-extra.pri1
-rw-r--r--recipes-qt/qt5/qtbase/rpi/oe-device-extra.pri10
-rw-r--r--recipes-qt/qt5/qtbase/ti33x/oe-device-extra.pri3
-rw-r--r--recipes-qt/qt5/qtbase_%.bbappend16
9 files changed, 86 insertions, 9 deletions
diff --git a/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb
index 1199da9..98ff5cc 100644
--- a/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb
+++ b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb
@@ -25,7 +25,44 @@ PR = "r0"
25LICENSE = "QtEnterprise" 25LICENSE = "QtEnterprise"
26LIC_FILES_CHKSUM = "file://${QT_LICENCE};md5=7bc9c54e450006250a60e96604c186c9" 26LIC_FILES_CHKSUM = "file://${QT_LICENCE};md5=7bc9c54e450006250a60e96604c186c9"
27 27
28inherit populate_sdk populate_sdk_qt5 28inherit populate_sdk populate_sdk_qt5 qmake5_paths
29 29
30TOOLCHAIN_HOST_TASK += "nativesdk-packagegroup-b2qt-embedded-qt5-toolchain-host" 30TOOLCHAIN_HOST_TASK += "nativesdk-packagegroup-b2qt-embedded-qt5-toolchain-host"
31TOOLCHAIN_TARGET_TASK += "packagegroup-b2qt-embedded-qt5-toolchain-target" 31TOOLCHAIN_TARGET_TASK += "packagegroup-b2qt-embedded-qt5-toolchain-target"
32
33SRC_URI = " \
34 file://qmake.conf \
35 file://qplatformdefs.h \
36 "
37
38SDK_MKSPEC_DIR = "${SDK_OUTPUT}${SDKTARGETSYSROOT}${libdir}/${QT_DIR_NAME}/mkspecs"
39SDK_MKSPEC = "devices/linux-oe-generic-g++"
40SDK_DEVICE_PRI = "${SDK_MKSPEC_DIR}/qdevice.pri"
41SDK_DYNAMIC_FLAGS = "-O. -pipe -g"
42
43create_sdk_files_append () {
44 # Install the toolchain user's generic device mkspec
45 install -d ${SDK_MKSPEC_DIR}/${SDK_MKSPEC}
46 install -m 0644 ${WORKDIR}/qmake.conf ${SDK_MKSPEC_DIR}/${SDK_MKSPEC}
47 install -m 0644 ${WORKDIR}/qplatformdefs.h ${SDK_MKSPEC_DIR}/${SDK_MKSPEC}
48
49 # Fill in the qdevice.pri file which will be used by the device mksspec
50 static_cflags="${TARGET_CFLAGS}"
51 static_cxxflags="${TARGET_CXXFLAGS}"
52 for i in ${SDK_DYNAMIC_FLAGS}; do
53 static_cflags=$(echo $static_cflags | sed -e "s/$i //")
54 static_cxxflags=$(echo $static_cxxflags | sed -e "s/$i //")
55 done
56 echo "MACHINE = ${MACHINE}" > ${SDK_DEVICE_PRI}
57 echo "CROSS_COMPILE = ${SDKPATHNATIVE}${bindir_nativesdk}/${TARGET_SYS}/${TARGET_PREFIX}" >> ${SDK_DEVICE_PRI}
58 echo "QMAKE_CFLAGS *= ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT} ${static_cflags}" >> ${SDK_DEVICE_PRI}
59 echo "QMAKE_CXXFLAGS *= ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT} ${static_cxxflags}" >> ${SDK_DEVICE_PRI}
60 echo "QMAKE_LFLAGS *= ${TARGET_CC_ARCH} --sysroot=${SDKTARGETSYSROOT} ${TARGET_LDFLAGS}" >> ${SDK_DEVICE_PRI}
61
62 # Setup qt.conf to point at the device mkspec by default
63 qtconf=${SDK_OUTPUT}/${SDKPATHNATIVE}${OE_QMAKE_PATH_HOST_BINS}/qt.conf
64 echo 'HostSpec = linux-g++' >> $qtconf
65 echo 'TargetSpec = devices/linux-oe-generic-g++' >> $qtconf
66}
67
68SDK_POST_INSTALL_COMMAND += "$SUDO_EXEC sed -i -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" $native_sysroot/mkspecs/qdevice.pri ;"
diff --git a/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qmake.conf b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qmake.conf
new file mode 100644
index 0000000..dadea00
--- /dev/null
+++ b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qmake.conf
@@ -0,0 +1,14 @@
1#
2# qmake configuration for using yocto-built b2qt toolchain
3#
4
5include(../common/linux_device_pre.conf)
6
7QMAKE_PLATFORM += boot2qt
8
9# Load device-specific qmake.conf part, if any
10exists(../../oe-device-extra.pri):include(../../oe-device-extra.pri)
11
12include(../common/linux_device_post.conf)
13
14load(qt_config)
diff --git a/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qplatformdefs.h b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qplatformdefs.h
new file mode 100644
index 0000000..e10ebcf
--- /dev/null
+++ b/recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qplatformdefs.h
@@ -0,0 +1,2 @@
1
2#include "../../linux-g++/qplatformdefs.h"
diff --git a/recipes-qt/qt5/qtbase/emulator/oe-device-extra.pri b/recipes-qt/qt5/qtbase/emulator/oe-device-extra.pri
new file mode 100644
index 0000000..3c0971c
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/emulator/oe-device-extra.pri
@@ -0,0 +1,2 @@
1QMAKE_LIBS_EGL = -lQtGlesStreamClient
2QMAKE_LIBS_OPENGL_ES2 = -lQtGlesStreamClient
diff --git a/recipes-qt/qt5/qtbase/mx6/oe-device-extra.pri b/recipes-qt/qt5/qtbase/mx6/oe-device-extra.pri
new file mode 100644
index 0000000..cf89ae6
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/mx6/oe-device-extra.pri
@@ -0,0 +1,8 @@
1IMX6_CFLAGS = -DLINUX=1 -DEGL_API_FB=1
2QMAKE_LIBS_EGL += -lEGL
3QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
4QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL
5QMAKE_CFLAGS += $$IMX6_CFLAGS
6QMAKE_CXXFLAGS += $$IMX6_CFLAGS
7
8EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/devices/linux-imx6-g++/qeglfshooks_imx6.cpp
diff --git a/recipes-qt/qt5/qtbase/oe-device-extra.pri b/recipes-qt/qt5/qtbase/oe-device-extra.pri
new file mode 100644
index 0000000..6c4bdd9
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/oe-device-extra.pri
@@ -0,0 +1 @@
# This file contains device-specific qmake.conf settings
diff --git a/recipes-qt/qt5/qtbase/rpi/oe-device-extra.pri b/recipes-qt/qt5/qtbase/rpi/oe-device-extra.pri
new file mode 100644
index 0000000..bddd245
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/rpi/oe-device-extra.pri
@@ -0,0 +1,10 @@
1QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/usr/include/interface/vcos/pthreads \
2 $$[QT_SYSROOT]/usr/include/interface/vmcs_host/linux
3QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL}
4
5QMAKE_LIBS_EGL = -lEGL -lGLESv2
6QMAKE_CFLAGS += $$RPI_CFLAGS
7QMAKE_CXXFLAGS += $$RPI_CFLAGS
8
9EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
10EGLFS_PLATFORM_HOOKS_LIBS = -lbcm_host
diff --git a/recipes-qt/qt5/qtbase/ti33x/oe-device-extra.pri b/recipes-qt/qt5/qtbase/ti33x/oe-device-extra.pri
new file mode 100644
index 0000000..6a5edd9
--- /dev/null
+++ b/recipes-qt/qt5/qtbase/ti33x/oe-device-extra.pri
@@ -0,0 +1,3 @@
1QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um
2QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL}
3QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL}
diff --git a/recipes-qt/qt5/qtbase_%.bbappend b/recipes-qt/qt5/qtbase_%.bbappend
index 27b476b..340d308 100644
--- a/recipes-qt/qt5/qtbase_%.bbappend
+++ b/recipes-qt/qt5/qtbase_%.bbappend
@@ -34,20 +34,20 @@ PACKAGECONFIG += " \
34 tslib \ 34 tslib \
35 " 35 "
36 36
37FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"
38
39SRC_URI += " \
40 file://oe-device-extra.pri \
41 "
42
37do_configure_prepend() { 43do_configure_prepend() {
44 install -m 0644 ${WORKDIR}/oe-device-extra.pri ${S}/mkspecs
38 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf 45 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
39 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF 46 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
40QMAKE_PLATFORM += boot2qt 47QMAKE_PLATFORM += boot2qt
41QT_QPA_DEFAULT_PLATFORM = eglfs 48QT_QPA_DEFAULT_PLATFORM = eglfs
42load(qt_config)
43EOF
44}
45 49
46do_configure_prepend_emulator() { 50exists(../oe-device-extra.pri):include(../oe-device-extra.pri)
47 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
48 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
49QMAKE_LIBS_EGL = -lQtGlesStreamClient
50QMAKE_LIBS_OPENGL_ES2 = -lQtGlesStreamClient
51 51
52load(qt_config) 52load(qt_config)
53EOF 53EOF