diff options
author | Eirik Aavitsland <eirik.aavitsland@theqtcompany.com> | 2015-05-13 15:44:02 +0200 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@theqtcompany.com> | 2015-05-28 14:13:39 +0300 |
commit | e8067960ac419c9a47824fa996283d31faa9c309 (patch) | |
tree | 2527ba7b8be52be88a2e45dd785100156a1930e5 /recipes-qt | |
parent | 10c6c4ef744ca122f976be1d4f68713cafc01730 (diff) | |
download | meta-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')
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" | |||
25 | LICENSE = "QtEnterprise" | 25 | LICENSE = "QtEnterprise" |
26 | LIC_FILES_CHKSUM = "file://${QT_LICENCE};md5=7bc9c54e450006250a60e96604c186c9" | 26 | LIC_FILES_CHKSUM = "file://${QT_LICENCE};md5=7bc9c54e450006250a60e96604c186c9" |
27 | 27 | ||
28 | inherit populate_sdk populate_sdk_qt5 | 28 | inherit populate_sdk populate_sdk_qt5 qmake5_paths |
29 | 29 | ||
30 | TOOLCHAIN_HOST_TASK += "nativesdk-packagegroup-b2qt-embedded-qt5-toolchain-host" | 30 | TOOLCHAIN_HOST_TASK += "nativesdk-packagegroup-b2qt-embedded-qt5-toolchain-host" |
31 | TOOLCHAIN_TARGET_TASK += "packagegroup-b2qt-embedded-qt5-toolchain-target" | 31 | TOOLCHAIN_TARGET_TASK += "packagegroup-b2qt-embedded-qt5-toolchain-target" |
32 | |||
33 | SRC_URI = " \ | ||
34 | file://qmake.conf \ | ||
35 | file://qplatformdefs.h \ | ||
36 | " | ||
37 | |||
38 | SDK_MKSPEC_DIR = "${SDK_OUTPUT}${SDKTARGETSYSROOT}${libdir}/${QT_DIR_NAME}/mkspecs" | ||
39 | SDK_MKSPEC = "devices/linux-oe-generic-g++" | ||
40 | SDK_DEVICE_PRI = "${SDK_MKSPEC_DIR}/qdevice.pri" | ||
41 | SDK_DYNAMIC_FLAGS = "-O. -pipe -g" | ||
42 | |||
43 | create_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 | |||
68 | SDK_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 | |||
5 | include(../common/linux_device_pre.conf) | ||
6 | |||
7 | QMAKE_PLATFORM += boot2qt | ||
8 | |||
9 | # Load device-specific qmake.conf part, if any | ||
10 | exists(../../oe-device-extra.pri):include(../../oe-device-extra.pri) | ||
11 | |||
12 | include(../common/linux_device_post.conf) | ||
13 | |||
14 | load(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 @@ | |||
1 | QMAKE_LIBS_EGL = -lQtGlesStreamClient | ||
2 | QMAKE_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 @@ | |||
1 | IMX6_CFLAGS = -DLINUX=1 -DEGL_API_FB=1 | ||
2 | QMAKE_LIBS_EGL += -lEGL | ||
3 | QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL | ||
4 | QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL | ||
5 | QMAKE_CFLAGS += $$IMX6_CFLAGS | ||
6 | QMAKE_CXXFLAGS += $$IMX6_CFLAGS | ||
7 | |||
8 | EGLFS_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 @@ | |||
1 | QMAKE_INCDIR_EGL = $$[QT_SYSROOT]/usr/include/interface/vcos/pthreads \ | ||
2 | $$[QT_SYSROOT]/usr/include/interface/vmcs_host/linux | ||
3 | QMAKE_INCDIR_OPENGL_ES2 = $${QMAKE_INCDIR_EGL} | ||
4 | |||
5 | QMAKE_LIBS_EGL = -lEGL -lGLESv2 | ||
6 | QMAKE_CFLAGS += $$RPI_CFLAGS | ||
7 | QMAKE_CXXFLAGS += $$RPI_CFLAGS | ||
8 | |||
9 | EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp | ||
10 | EGLFS_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 @@ | |||
1 | QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um | ||
2 | QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL} | ||
3 | QMAKE_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 | ||
37 | FILESEXTRAPATHS_append := "${THISDIR}/${PN}:" | ||
38 | |||
39 | SRC_URI += " \ | ||
40 | file://oe-device-extra.pri \ | ||
41 | " | ||
42 | |||
37 | do_configure_prepend() { | 43 | do_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 |
40 | QMAKE_PLATFORM += boot2qt | 47 | QMAKE_PLATFORM += boot2qt |
41 | QT_QPA_DEFAULT_PLATFORM = eglfs | 48 | QT_QPA_DEFAULT_PLATFORM = eglfs |
42 | load(qt_config) | ||
43 | EOF | ||
44 | } | ||
45 | 49 | ||
46 | do_configure_prepend_emulator() { | 50 | exists(../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 | ||
49 | QMAKE_LIBS_EGL = -lQtGlesStreamClient | ||
50 | QMAKE_LIBS_OPENGL_ES2 = -lQtGlesStreamClient | ||
51 | 51 | ||
52 | load(qt_config) | 52 | load(qt_config) |
53 | EOF | 53 | EOF |