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 /scripts/configure-qtcreator.sh | |
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 'scripts/configure-qtcreator.sh')
-rwxr-xr-x | scripts/configure-qtcreator.sh | 118 |
1 files changed, 118 insertions, 0 deletions
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}" | ||