From 67e46f52ee60c3ef2c5a4dba1982f8193ce17bd0 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 15 May 2019 19:40:12 +0300 Subject: bare-metal: Implement cpp.compilerIncludePaths for KEIL toolchain Change-Id: I3a70a4a1045444bf053ebf5ac7f32dbe72c827a5 Reviewed-by: Christian Kandeler --- share/qbs/imports/qbs/Probes/KeilProbe.qbs | 6 ++++++ share/qbs/modules/cpp/keil.js | 16 ++++++++++++++++ share/qbs/modules/cpp/keil.qbs | 1 + 3 files changed, 23 insertions(+) diff --git a/share/qbs/imports/qbs/Probes/KeilProbe.qbs b/share/qbs/imports/qbs/Probes/KeilProbe.qbs index 9862a682a..1955fe480 100644 --- a/share/qbs/imports/qbs/Probes/KeilProbe.qbs +++ b/share/qbs/imports/qbs/Probes/KeilProbe.qbs @@ -44,6 +44,7 @@ PathProbe { property int versionMajor; property int versionMinor; property int versionPatch; + property stringList includePaths; property var compilerDefinesByLanguage; configure: { @@ -70,6 +71,11 @@ PathProbe { architecture = KEIL.guessArchitecture(macros); endianness = KEIL.guessEndianness(macros); + var defaultPaths = KEIL.dumpDefaultPaths( + compilerFilePath, architecture); + + includePaths = defaultPaths.includePaths; + var version = KEIL.guessVersion(macros); if (version) { versionMajor = version.major; diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js index fbdc0e9fb..c19fdd738 100644 --- a/share/qbs/modules/cpp/keil.js +++ b/share/qbs/modules/cpp/keil.js @@ -139,6 +139,22 @@ function dumpMacros(compilerFilePath, tag, nullDevice) { return map; } +function dumpDefaultPaths(compilerFilePath, architecture) { + var includePaths = []; + + if (architecture === "mcs51") { + var path = compilerFilePath.replace(/bin[\\\/](.*)$/i, "inc"); + includePaths.push(path); + } else if (architecture === "arm") { + var path = compilerFilePath.replace(/bin[\\\/](.*)$/i, "include"); + includePaths.push(path); + } + + return { + "includePaths": includePaths + }; +} + function adjustPathsToWindowsSeparators(sourcePaths) { var resulingPaths = []; sourcePaths.forEach(function(path) { diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index 3d03f9112..10bc39e12 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -61,6 +61,7 @@ CppModule { endianness: keilProbe.endianness compilerDefinesByLanguage: keilProbe.compilerDefinesByLanguage + compilerIncludePaths: keilProbe.includePaths property string toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined -- cgit v1.2.3