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 | |
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>
-rw-r--r-- | meta-fsl-extras/recipes/qt5/qtbase_%.bbappend | 38 | ||||
-rw-r--r-- | meta-raspberrypi-extras/recipes/qt5/qtbase_%.bbappend | 42 | ||||
-rw-r--r-- | meta-ti-extras/recipes/qt5/qtbase_%.bbappend | 33 | ||||
-rw-r--r-- | recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk.bb | 39 | ||||
-rw-r--r-- | recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qmake.conf | 14 | ||||
-rw-r--r-- | recipes-qt/meta/meta-toolchain-b2qt-embedded-qt5-sdk/qplatformdefs.h | 2 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase/emulator/oe-device-extra.pri | 2 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase/mx6/oe-device-extra.pri | 8 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase/oe-device-extra.pri | 1 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase/rpi/oe-device-extra.pri | 10 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase/ti33x/oe-device-extra.pri | 3 | ||||
-rw-r--r-- | recipes-qt/qt5/qtbase_%.bbappend | 16 | ||||
-rwxr-xr-x | scripts/configure-qtcreator.sh | 118 |
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 | |||
23 | do_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 | ||
26 | IMX6_CFLAGS = -DLINUX=1 -DEGL_API_FB=1 | ||
27 | QMAKE_LIBS_EGL += -lEGL | ||
28 | QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lEGL -lGAL | ||
29 | QMAKE_LIBS_OPENVG += -lOpenVG -lEGL -lGAL | ||
30 | QMAKE_CFLAGS += \$\$IMX6_CFLAGS | ||
31 | QMAKE_CXXFLAGS += \$\$IMX6_CFLAGS | ||
32 | |||
33 | EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/../devices/linux-imx6-g++/qeglfshooks_imx6.cpp | ||
34 | |||
35 | load(qt_config) | ||
36 | |||
37 | EOF | ||
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 | |||
23 | do_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 | RPI_CFLAGS = -DLINUX=1 -DEGL_API_FB=1 | ||
27 | |||
28 | QMAKE_INCDIR_EGL = \$\$[QT_SYSROOT]/usr/include/interface/vcos/pthreads \ | ||
29 | \$\$[QT_SYSROOT]/usr/include/interface/vmcs_host/linux | ||
30 | QMAKE_INCDIR_OPENGL_ES2 = \$\${QMAKE_INCDIR_EGL} | ||
31 | |||
32 | QMAKE_LIBS_EGL = -lEGL -lGLESv2 | ||
33 | QMAKE_CFLAGS += \$\$RPI_CFLAGS | ||
34 | QMAKE_CXXFLAGS += \$\$RPI_CFLAGS | ||
35 | |||
36 | EGLFS_PLATFORM_HOOKS_SOURCES = \$\$PWD/../devices/linux-rasp-pi-g++/qeglfshooks_pi.cpp | ||
37 | EGLFS_PLATFORM_HOOKS_LIBS = -lbcm_host | ||
38 | |||
39 | load(qt_config) | ||
40 | |||
41 | EOF | ||
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 | |||
23 | do_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 | |||
27 | QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um | ||
28 | QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 \$\${QMAKE_LIBS_EGL} | ||
29 | QMAKE_LIBS_OPENVG = -lOpenVG \$\${QMAKE_LIBS_EGL} | ||
30 | |||
31 | load(qt_config) | ||
32 | EOF | ||
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" | |||
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 |
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 | |||
24 | set -e | ||
25 | |||
26 | MKSPEC="devices/linux-oe-generic-g++" | ||
27 | ABI="arm-linux-generic-elf-32bit" | ||
28 | ### TBD: detect ABI | ||
29 | |||
30 | printUsage () | ||
31 | { | ||
32 | echo "Usage: $0 <toolchain-environment-setup-file> [--remove]" | ||
33 | } | ||
34 | |||
35 | while 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 | ||
51 | done | ||
52 | |||
53 | if [ ! -f "$CONFIG" ]; then | ||
54 | printUsage | ||
55 | exit 1 | ||
56 | fi | ||
57 | |||
58 | if [ -z "${SDKTOOL}" ]; then | ||
59 | SDKTOOL="${HOME}/Qt/Tools/QtCreator/bin/sdktool" | ||
60 | fi | ||
61 | if [ ! -x ${SDKTOOL} ]; then | ||
62 | echo "Cannot find 'sdktool'" | ||
63 | exit 1 | ||
64 | fi | ||
65 | |||
66 | source $CONFIG | ||
67 | |||
68 | if [ ! -d "${OECORE_NATIVE_SYSROOT}/mkspecs/${MKSPEC}" ]; then | ||
69 | echo Error: $CONFIG is invalid. | ||
70 | exit 1 | ||
71 | fi | ||
72 | |||
73 | MACHINE=$(grep '^MACHINE' ${OECORE_NATIVE_SYSROOT}/mkspecs/qdevice.pri | cut -d'=' -f2 | tr -d ' ') | ||
74 | |||
75 | RELEASE=$(qmake -query QT_VERSION) | ||
76 | |||
77 | BASEID="byos.${RELEASE}.${MACHINE}" | ||
78 | |||
79 | BASENAME="Custom Qt Embedded" | ||
80 | TOOLCHAINNAME="GCC (${BASENAME} ${RELEASE} ${MACHINE})" | ||
81 | QTNAME="${BASENAME} ${RELEASE} ${MACHINE}" | ||
82 | KITNAME="${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 | |||
88 | if [ -n "${REMOVEONLY}" ]; then | ||
89 | echo "Kit removed: ${KITNAME}" | ||
90 | exit 0 | ||
91 | fi | ||
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 | |||
117 | echo "Configured Qt Creator with new kit:" | ||
118 | echo " ${KITNAME}" | ||