From e8067960ac419c9a47824fa996283d31faa9c309 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 13 May 2015 15:44:02 +0200 Subject: 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 --- scripts/configure-qtcreator.sh | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 scripts/configure-qtcreator.sh (limited to 'scripts') 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 @@ +#!/bin/bash +############################################################################# +## +## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +## +## This file is part of the Qt Enterprise Embedded Scripts of the Qt +## framework. +## +## $QT_BEGIN_LICENSE$ +## Commercial License Usage Only +## Licensees holding valid commercial Qt license agreements with Digia +## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, +## may use this file in accordance with the terms contained in said license +## agreement. +## +## For further information use the contact form at +## http://www.qt.io/contact-us. +## +## +## $QT_END_LICENSE$ +## +############################################################################# + +set -e + +MKSPEC="devices/linux-oe-generic-g++" +ABI="arm-linux-generic-elf-32bit" +### TBD: detect ABI + +printUsage () +{ + echo "Usage: $0 [--remove]" +} + +while test -n "$1"; do + case "$1" in + "--help" | "-h") + printUsage + exit 0 + shift + ;; + "--remove") + REMOVEONLY=1 + shift + ;; + *) + CONFIG=$1 + shift + ;; + esac +done + +if [ ! -f "$CONFIG" ]; then + printUsage + exit 1 +fi + +if [ -z "${SDKTOOL}" ]; then + SDKTOOL="${HOME}/Qt/Tools/QtCreator/bin/sdktool" +fi +if [ ! -x ${SDKTOOL} ]; then + echo "Cannot find 'sdktool'" + exit 1 +fi + +source $CONFIG + +if [ ! -d "${OECORE_NATIVE_SYSROOT}/mkspecs/${MKSPEC}" ]; then + echo Error: $CONFIG is invalid. + exit 1 +fi + +MACHINE=$(grep '^MACHINE' ${OECORE_NATIVE_SYSROOT}/mkspecs/qdevice.pri | cut -d'=' -f2 | tr -d ' ') + +RELEASE=$(qmake -query QT_VERSION) + +BASEID="byos.${RELEASE}.${MACHINE}" + +BASENAME="Custom Qt Embedded" +TOOLCHAINNAME="GCC (${BASENAME} ${RELEASE} ${MACHINE})" +QTNAME="${BASENAME} ${RELEASE} ${MACHINE}" +KITNAME="${BASENAME} ${RELEASE} ${MACHINE} Kit" + +${SDKTOOL} rmKit --id ${BASEID}.kit 2>/dev/null || true +${SDKTOOL} rmQt --id ${BASEID}.qt || true +${SDKTOOL} rmTC --id ProjectExplorer.ToolChain.Gcc:${BASEID}.tc || true + +if [ -n "${REMOVEONLY}" ]; then + echo "Kit removed: ${KITNAME}" + exit 0 +fi + +${SDKTOOL} addTC \ + --id "ProjectExplorer.ToolChain.Gcc:${BASEID}.tc" \ + --name "${TOOLCHAINNAME}" \ + --path "$(type -p ${OE_QMAKE_CXX})" \ + --abi "${ABI}" + +${SDKTOOL} addQt \ + --id "${BASEID}.qt" \ + --name "${QTNAME}" \ + --type "Boot2Qt.QtVersionType" \ + --qmake "$(type -p qmake)" + +${SDKTOOL} addKit \ + --id "${BASEID}.kit" \ + --name "${KITNAME}" \ + --qt "${BASEID}.qt" \ + --debuggerengine "1" \ + --debugger "$(type -p ${GDB})" \ + --sysroot "${SDKTARGETSYSROOT}" \ + --devicetype "Boot2Qt.HwDevice" \ + --toolchain "ProjectExplorer.ToolChain.Gcc:${BASEID}.tc" \ + --icon ":/boot2qt/images/B2Qt_QtC_icon.png" \ + --mkspec "${MKSPEC}" + +echo "Configured Qt Creator with new kit:" +echo " ${KITNAME}" -- cgit v1.2.3-54-g00ecf