summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--meta-fsl-extras/recipes/qt5/qtbase_%.bbappend38
-rw-r--r--meta-raspberrypi-extras/recipes/qt5/qtbase_%.bbappend42
-rw-r--r--meta-ti-extras/recipes/qt5/qtbase_%.bbappend33
-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
-rwxr-xr-xscripts/configure-qtcreator.sh118
13 files changed, 204 insertions, 122 deletions
diff --git a/meta-fsl-extras/recipes/qt5/qtbase_%.bbappend b/meta-fsl-extras/recipes/qt5/qtbase_%.bbappend
deleted file mode 100644
index 11fbab1..0000000
--- a/meta-fsl-extras/recipes/qt5/qtbase_%.bbappend
+++ /dev/null
@@ -1,38 +0,0 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://www.qt.io/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23do_configure_prepend_mx6() {
24 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
25 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
26IMX6_CFLAGS = -DLINUX=1 -DEGL_API_FB=1
27QMAKE_LIBS_EGL += -lEGL
28QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL
29QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL
30QMAKE_CFLAGS += \$\$IMX6_CFLAGS
31QMAKE_CXXFLAGS += \$\$IMX6_CFLAGS
32
33EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/../devices/linux-imx6-g++/qeglfshooks_imx6.cpp
34
35load(qt_config)
36
37EOF
38}
diff --git a/meta-raspberrypi-extras/recipes/qt5/qtbase_%.bbappend b/meta-raspberrypi-extras/recipes/qt5/qtbase_%.bbappend
deleted file mode 100644
index 92e08b7..0000000
--- a/meta-raspberrypi-extras/recipes/qt5/qtbase_%.bbappend
+++ /dev/null
@@ -1,42 +0,0 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://www.qt.io/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23do_configure_prepend_rpi() {
24 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
25 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
26RPI_CFLAGS = -DLINUX=1 -DEGL_API_FB=1
27
28QMAKE_INCDIR_EGL = \$\$[QT_SYSROOT]/usr/include/interface/vcos/pthreads \
29 \$\$[QT_SYSROOT]/usr/include/interface/vmcs_host/linux
30QMAKE_INCDIR_OPENGL_ES2 = \$\${QMAKE_INCDIR_EGL}
31
32QMAKE_LIBS_EGL = -lEGL -lGLESv2
33QMAKE_CFLAGS += \$\$RPI_CFLAGS
34QMAKE_CXXFLAGS += \$\$RPI_CFLAGS
35
36EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/../devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp
37EGLFS_PLATFORM_HOOKS_LIBS = -lbcm_host
38
39load(qt_config)
40
41EOF
42}
diff --git a/meta-ti-extras/recipes/qt5/qtbase_%.bbappend b/meta-ti-extras/recipes/qt5/qtbase_%.bbappend
deleted file mode 100644
index ada9f02..0000000
--- a/meta-ti-extras/recipes/qt5/qtbase_%.bbappend
+++ /dev/null
@@ -1,33 +0,0 @@
1#############################################################################
2##
3## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4##
5## This file is part of the Qt Enterprise Embedded Scripts of the Qt
6## framework.
7##
8## $QT_BEGIN_LICENSE$
9## Commercial License Usage Only
10## Licensees holding valid commercial Qt license agreements with Digia
11## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
12## may use this file in accordance with the terms contained in said license
13## agreement.
14##
15## For further information use the contact form at
16## http://www.qt.io/contact-us.
17##
18##
19## $QT_END_LICENSE$
20##
21#############################################################################
22
23do_configure_prepend_rpi() {
24 sed -i 's!load(qt_config)!!' ${S}/mkspecs/linux-oe-g++/qmake.conf
25 cat >> ${S}/mkspecs/linux-oe-g++/qmake.conf <<EOF
26
27QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um
28QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 \$\${QMAKE_LIBS_EGL}
29QMAKE_LIBS_OPENVG = -lOpenVG \$\${QMAKE_LIBS_EGL}
30
31load(qt_config)
32EOF
33}
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
diff --git a/scripts/configure-qtcreator.sh b/scripts/configure-qtcreator.sh
new file mode 100755
index 0000000..4ffe64f
--- /dev/null
+++ b/scripts/configure-qtcreator.sh
@@ -0,0 +1,118 @@
1#!/bin/bash
2#############################################################################
3##
4## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
5##
6## This file is part of the Qt Enterprise Embedded Scripts of the Qt
7## framework.
8##
9## $QT_BEGIN_LICENSE$
10## Commercial License Usage Only
11## Licensees holding valid commercial Qt license agreements with Digia
12## with an appropriate addendum covering the Qt Enterprise Embedded Scripts,
13## may use this file in accordance with the terms contained in said license
14## agreement.
15##
16## For further information use the contact form at
17## http://www.qt.io/contact-us.
18##
19##
20## $QT_END_LICENSE$
21##
22#############################################################################
23
24set -e
25
26MKSPEC="devices/linux-oe-generic-g++"
27ABI="arm-linux-generic-elf-32bit"
28### TBD: detect ABI
29
30printUsage ()
31{
32 echo "Usage: $0 <toolchain-environment-setup-file> [--remove]"
33}
34
35while test -n "$1"; do
36 case "$1" in
37 "--help" | "-h")
38 printUsage
39 exit 0
40 shift
41 ;;
42 "--remove")
43 REMOVEONLY=1
44 shift
45 ;;
46 *)
47 CONFIG=$1
48 shift
49 ;;
50 esac
51done
52
53if [ ! -f "$CONFIG" ]; then
54 printUsage
55 exit 1
56fi
57
58if [ -z "${SDKTOOL}" ]; then
59 SDKTOOL="${HOME}/Qt/Tools/QtCreator/bin/sdktool"
60fi
61if [ ! -x ${SDKTOOL} ]; then
62 echo "Cannot find 'sdktool'"
63 exit 1
64fi
65
66source $CONFIG
67
68if [ ! -d "${OECORE_NATIVE_SYSROOT}/mkspecs/${MKSPEC}" ]; then
69 echo Error: $CONFIG is invalid.
70 exit 1
71fi
72
73MACHINE=$(grep '^MACHINE' ${OECORE_NATIVE_SYSROOT}/mkspecs/qdevice.pri | cut -d'=' -f2 | tr -d ' ')
74
75RELEASE=$(qmake -query QT_VERSION)
76
77BASEID="byos.${RELEASE}.${MACHINE}"
78
79BASENAME="Custom Qt Embedded"
80TOOLCHAINNAME="GCC (${BASENAME} ${RELEASE} ${MACHINE})"
81QTNAME="${BASENAME} ${RELEASE} ${MACHINE}"
82KITNAME="${BASENAME} ${RELEASE} ${MACHINE} Kit"
83
84${SDKTOOL} rmKit --id ${BASEID}.kit 2>/dev/null || true
85${SDKTOOL} rmQt --id ${BASEID}.qt || true
86${SDKTOOL} rmTC --id ProjectExplorer.ToolChain.Gcc:${BASEID}.tc || true
87
88if [ -n "${REMOVEONLY}" ]; then
89 echo "Kit removed: ${KITNAME}"
90 exit 0
91fi
92
93${SDKTOOL} addTC \
94 --id "ProjectExplorer.ToolChain.Gcc:${BASEID}.tc" \
95 --name "${TOOLCHAINNAME}" \
96 --path "$(type -p ${OE_QMAKE_CXX})" \
97 --abi "${ABI}"
98
99${SDKTOOL} addQt \
100 --id "${BASEID}.qt" \
101 --name "${QTNAME}" \
102 --type "Boot2Qt.QtVersionType" \
103 --qmake "$(type -p qmake)"
104
105${SDKTOOL} addKit \
106 --id "${BASEID}.kit" \
107 --name "${KITNAME}" \
108 --qt "${BASEID}.qt" \
109 --debuggerengine "1" \
110 --debugger "$(type -p ${GDB})" \
111 --sysroot "${SDKTARGETSYSROOT}" \
112 --devicetype "Boot2Qt.HwDevice" \
113 --toolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.tc" \
114 --icon ":/boot2qt/images/B2Qt_QtC_icon.png" \
115 --mkspec "${MKSPEC}"
116
117echo "Configured Qt Creator with new kit:"
118echo " ${KITNAME}"