diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-07-23 21:58:42 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-07-24 15:39:04 +0000 |
commit | 1839ae9bd16928329680b772038a8cad230cfe07 (patch) | |
tree | 3ed9f2aadc1c6452db0a7875cb21488174e54db8 | |
parent | 05ca2e5daa0aedfcfd311658cb62d417acc9b247 (diff) |
baremetal: Fix detection of C++ language option for IAR
... which is used at dumping of predefined macros
and a header paths.
Reason is that for the different architectures the IAR
use different C++ language options:
* for ARM: --c++
* for AVR or 8051: --ec++
Change-Id: Ic2b4d50e9e2a978a5cbc69ed5353d5953e83c85d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | share/qbs/modules/cpp/iar.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js index 3098c88f6..33093c0a3 100644 --- a/share/qbs/modules/cpp/iar.js +++ b/share/qbs/modules/cpp/iar.js @@ -56,6 +56,17 @@ function guessEndianness(macros) return "big" } +function cppLanguageOption(compilerFilePath) +{ + var baseName = FileInfo.baseName(compilerFilePath); + if (baseName === "iccarm") + return "--c++"; + if (baseName === "icc8051" || baseName === "iccavr") + return "--ec++"; + throw "Unable to deduce C++ language option for unsupported compiler: '" + + FileInfo.toNativeSeparators(compilerFilePath) + "'"; +} + function dumpMacros(compilerFilePath, tag) { var tempDir = new TemporaryDir(); var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c"); @@ -64,7 +75,7 @@ function dumpMacros(compilerFilePath, tag) { var args = [ inFilePath, "--predef_macros", outFilePath ]; if (tag && tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); p.exec(compilerFilePath, args, true); @@ -84,7 +95,7 @@ function dumpDefaultPaths(compilerFilePath, tag) { var args = [ inFilePath, "--preinclude", "." ]; if (tag === "cpp") - args.push("--c++"); + args.push(cppLanguageOption(compilerFilePath)); var p = new Process(); // This process should return an error, don't throw |