diff options
Diffstat (limited to 'meta-boot2qt/files/configure-qtcreator.sh')
-rwxr-xr-x | meta-boot2qt/files/configure-qtcreator.sh | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/meta-boot2qt/files/configure-qtcreator.sh b/meta-boot2qt/files/configure-qtcreator.sh new file mode 100755 index 0000000..7386f70 --- /dev/null +++ b/meta-boot2qt/files/configure-qtcreator.sh | |||
@@ -0,0 +1,173 @@ | |||
1 | #!/bin/bash | ||
2 | ############################################################################ | ||
3 | ## | ||
4 | ## Copyright (C) 2016 The Qt Company Ltd. | ||
5 | ## Contact: https://www.qt.io/licensing/ | ||
6 | ## | ||
7 | ## This file is part of the Boot to Qt meta layer. | ||
8 | ## | ||
9 | ## $QT_BEGIN_LICENSE:GPL$ | ||
10 | ## Commercial License Usage | ||
11 | ## Licensees holding valid commercial Qt licenses may use this file in | ||
12 | ## accordance with the commercial license agreement provided with the | ||
13 | ## Software or, alternatively, in accordance with the terms contained in | ||
14 | ## a written agreement between you and The Qt Company. For licensing terms | ||
15 | ## and conditions see https://www.qt.io/terms-conditions. For further | ||
16 | ## information use the contact form at https://www.qt.io/contact-us. | ||
17 | ## | ||
18 | ## GNU General Public License Usage | ||
19 | ## Alternatively, this file may be used under the terms of the GNU | ||
20 | ## General Public License version 3 or (at your option) any later version | ||
21 | ## approved by the KDE Free Qt Foundation. The licenses are as published by | ||
22 | ## the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||
23 | ## included in the packaging of this file. Please review the following | ||
24 | ## information to ensure the GNU General Public License requirements will | ||
25 | ## be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||
26 | ## | ||
27 | ## $QT_END_LICENSE$ | ||
28 | ## | ||
29 | ############################################################################ | ||
30 | |||
31 | set -e | ||
32 | |||
33 | ABI="arm-linux-generic-elf-32bit" | ||
34 | CONFIG="" | ||
35 | |||
36 | printUsage () | ||
37 | { | ||
38 | echo "Usage: $0 --config <environment-setup-file> [--remove] [--qtcreator <path>] [--name <basename>] [--appman]" | ||
39 | } | ||
40 | |||
41 | while test -n "$1"; do | ||
42 | case "$1" in | ||
43 | "--remove") | ||
44 | REMOVEONLY=1 | ||
45 | ;; | ||
46 | "--appman") | ||
47 | APPMAN=1 | ||
48 | ;; | ||
49 | "--qtcreator") | ||
50 | shift | ||
51 | QTCREATOR=$1 | ||
52 | ;; | ||
53 | "--config") | ||
54 | shift | ||
55 | CONFIG=$1 | ||
56 | ;; | ||
57 | "--name") | ||
58 | shift | ||
59 | NAME=$1 | ||
60 | ;; | ||
61 | *) | ||
62 | printUsage | ||
63 | exit 0 | ||
64 | ;; | ||
65 | esac | ||
66 | shift | ||
67 | done | ||
68 | |||
69 | if [ ! -f "$CONFIG" ]; then | ||
70 | printUsage | ||
71 | exit 1 | ||
72 | fi | ||
73 | |||
74 | if [ -z "${QTCREATOR}" ]; then | ||
75 | SDKTOOL="${HOME}/Qt/Tools/QtCreator/libexec/qtcreator/sdktool" | ||
76 | else | ||
77 | SDKTOOL="${QTCREATOR}/libexec/qtcreator/sdktool" | ||
78 | fi | ||
79 | if [ ! -x ${SDKTOOL} ]; then | ||
80 | echo "Cannot find 'sdktool' from QtCreator" | ||
81 | printUsage | ||
82 | exit 1 | ||
83 | fi | ||
84 | |||
85 | source $CONFIG | ||
86 | |||
87 | MKSPEC="devices/linux-oe-generic-g++" | ||
88 | MKSPECPATH=$(find ${OECORE_TARGET_SYSROOT} -name $(basename ${MKSPEC}) 2>/dev/null || true) | ||
89 | if [ ! -d "${MKSPECPATH}" ]; then | ||
90 | echo "Error: could not find mkspec ${MKSPEC} from the toolchain" | ||
91 | exit 1 | ||
92 | fi | ||
93 | |||
94 | MACHINE=$(grep '^MACHINE' ${MKSPECPATH}/../../qdevice.pri | cut -d'=' -f2 | tr -d ' ') | ||
95 | |||
96 | RELEASE=$(qmake -query QT_VERSION) | ||
97 | |||
98 | NAME=${NAME:-"Custom Qt ${RELEASE} ${MACHINE}"} | ||
99 | BASEID="byos.${RELEASE}.${MACHINE}" | ||
100 | |||
101 | ${SDKTOOL} rmKit --id ${BASEID}.kit 2>/dev/null || true | ||
102 | ${SDKTOOL} rmKit --id ${BASEID}.am.kit 2>/dev/null || true | ||
103 | ${SDKTOOL} rmQt --id ${BASEID}.qt || true | ||
104 | ${SDKTOOL} rmQt --id ${BASEID}.am.qt || true | ||
105 | ${SDKTOOL} rmTC --id ProjectExplorer.ToolChain.Gcc:${BASEID}.gcc || true | ||
106 | ${SDKTOOL} rmTC --id ProjectExplorer.ToolChain.Gcc:${BASEID}.g++ || true | ||
107 | ${SDKTOOL} rmDebugger --id ${BASEID}.gdb 2>/dev/null || true | ||
108 | |||
109 | if [ -n "${REMOVEONLY}" ]; then | ||
110 | echo "Kit removed: ${NAME}" | ||
111 | exit 0 | ||
112 | fi | ||
113 | |||
114 | ${SDKTOOL} addTC \ | ||
115 | --id "ProjectExplorer.ToolChain.Gcc:${BASEID}.gcc" \ | ||
116 | --name "GCC (${NAME})" \ | ||
117 | --path "$(type -p ${CC})" \ | ||
118 | --abi "${ABI}" \ | ||
119 | --language 1 | ||
120 | |||
121 | ${SDKTOOL} addTC \ | ||
122 | --id "ProjectExplorer.ToolChain.Gcc:${BASEID}.g++" \ | ||
123 | --name "G++ (${NAME})" \ | ||
124 | --path "$(type -p ${CXX})" \ | ||
125 | --abi "${ABI}" \ | ||
126 | --language 2 | ||
127 | |||
128 | ${SDKTOOL} addDebugger \ | ||
129 | --id "${BASEID}.gdb" \ | ||
130 | --name "GDB (${NAME})" \ | ||
131 | --engine 1 \ | ||
132 | --binary "$(type -p ${GDB})" \ | ||
133 | --abis "${ABI}" | ||
134 | |||
135 | ${SDKTOOL} addQt \ | ||
136 | --id "${BASEID}.qt" \ | ||
137 | --name "${NAME}" \ | ||
138 | --type "Qdb.EmbeddedLinuxQt" \ | ||
139 | --qmake "$(type -p qmake)" | ||
140 | |||
141 | ${SDKTOOL} addKit \ | ||
142 | --id "${BASEID}.kit" \ | ||
143 | --name "${NAME}" \ | ||
144 | --qt "${BASEID}.qt" \ | ||
145 | --debuggerid "${BASEID}.gdb" \ | ||
146 | --sysroot "${SDKTARGETSYSROOT}" \ | ||
147 | --devicetype "QdbLinuxOsType" \ | ||
148 | --Ctoolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.gcc" \ | ||
149 | --Cxxtoolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.g++" \ | ||
150 | --icon ":/boot2qt/images/B2Qt_QtC_icon.png" \ | ||
151 | --mkspec "${MKSPEC}" | ||
152 | |||
153 | if [ -n "${APPMAN}" ]; then | ||
154 | ${SDKTOOL} addQt \ | ||
155 | --id "${BASEID}.am.qt" \ | ||
156 | --name "${NAME} [Application Manager]" \ | ||
157 | --type "AM.Qt" \ | ||
158 | --qmake "$(type -p qmake)" | ||
159 | |||
160 | ${SDKTOOL} addKit \ | ||
161 | --id "${BASEID}.am.kit" \ | ||
162 | --name "${NAME} [Application Manager]" \ | ||
163 | --qt "${BASEID}.am.qt" \ | ||
164 | --debuggerid "${BASEID}.gdb" \ | ||
165 | --sysroot "${SDKTARGETSYSROOT}" \ | ||
166 | --devicetype "AM.Device.Type" \ | ||
167 | --Ctoolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.gcc" \ | ||
168 | --Cxxtoolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.g++" \ | ||
169 | --icon ":/boot2qt/images/B2Qt_QtC_icon.png" \ | ||
170 | --mkspec "${MKSPEC}" | ||
171 | fi | ||
172 | |||
173 | echo "Configured Qt Creator with new kit: ${NAME}" | ||