aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/imports/qbs/Probes
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-03-19 16:23:32 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-04-10 12:31:41 +0000
commit77218b44b1b12c2b18e4655e114ec0323285e303 (patch)
tree9825e2ed7aca806e3da1702120aed7d9b6dab9c0 /share/qbs/imports/qbs/Probes
parent62e07306481373d9d9b6b656d855b204aa6964f3 (diff)
bare-metal: Add SDCC toolchain support
This commit adds a basic support for the SDCC compiler: * http://sdcc.sourceforge.net/ As this compiler support multiple architectures, then it is impossible to uniquely identify the current architecture by dumping of the pre-defined macros (because its content depends on a target flag). In this case the cpp.architecture will contains a default architecture (which is dumped with an omitted target flag). To use it with Qt Creator, it is enough to add there a desired Kit with a custom SDCC C/C++ compiler, and then set the following in the Kit's Qbs profile settings: * Key: qbs.toolchainType * Value: sdcc To create the SDCC profile it is enougth to use the following command: qbs setup-toolchains --type sdcc <path/to/sdcc/compiler/binary> <profile name> A toolchain type can be omitted; in this case the QBS will tries to detect the toolchain type from the specified compiler name. Also it is possible to auto-detect the SDCC toolchain from the PATH environment using the following command: qbs setup-toolchain --detect At current time are supported only the 8051 (aka MCS51) architecture; other architectures can be added later. Change-Id: I8cc239d62e35472ab667e054a64a1e59c2d548bd Reviewed-by: Richard Weickelt <richard@weickelt.de> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/imports/qbs/Probes')
-rw-r--r--share/qbs/imports/qbs/Probes/SdccProbe.qbs62
1 files changed, 62 insertions, 0 deletions
diff --git a/share/qbs/imports/qbs/Probes/SdccProbe.qbs b/share/qbs/imports/qbs/Probes/SdccProbe.qbs
new file mode 100644
index 000000000..4ff7b0ad8
--- /dev/null
+++ b/share/qbs/imports/qbs/Probes/SdccProbe.qbs
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Denis Shienkov <denis.shienkov@gmail.com>
+** Contact: http://www.qt.io/licensing
+**
+** This file is part of Qbs.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms and
+** conditions see http://www.qt.io/terms-conditions. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+import qbs.File
+import "../../../modules/cpp/sdcc.js" as SDCC
+
+PathProbe {
+ // Inputs
+ property string compilerFilePath;
+
+ // Outputs
+ property string architecture;
+ property string endianness;
+ property int versionMajor;
+ property int versionMinor;
+ property int versionPatch;
+
+ configure: {
+ if (!File.exists(compilerFilePath)) {
+ found = false;
+ return;
+ }
+
+ var macros = SDCC.dumpMacros(compilerFilePath, qbs);
+
+ architecture = SDCC.guessArchitecture(macros);
+ endianness = SDCC.guessEndianness(macros);
+
+ versionMajor = parseInt(macros["__SDCC_VERSION_MAJOR"], 10);
+ versionMinor = parseInt(macros["__SDCC_VERSION_MINOR"], 10);
+ versionPatch = parseInt(macros["__SDCC_VERSION_PATCH"], 10);
+
+ found = macros["SDCC"];
+ }
+}