aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/qbs-module.qdoc5
-rw-r--r--share/qbs/modules/cpp/iar.qbs1
-rw-r--r--share/qbs/modules/cpp/keil.qbs1
-rw-r--r--share/qbs/modules/cpp/sdcc.qbs1
-rw-r--r--tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs18
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.cpp18
-rw-r--r--tests/auto/blackbox/tst_blackboxbaremetal.h2
7 files changed, 46 insertions, 0 deletions
diff --git a/doc/reference/modules/qbs-module.qdoc b/doc/reference/modules/qbs-module.qdoc
index e72df697c..874e006e8 100644
--- a/doc/reference/modules/qbs-module.qdoc
+++ b/doc/reference/modules/qbs-module.qdoc
@@ -274,10 +274,15 @@
\li \c{"windows"}
\li \c{["windows"]}
\row
+ \li \c{"none"}
+ \li \c{["none"]}
+ \row
\li \c{undefined}
\li \c{[]}
\endtable
+ \note The "none" value is usually used for a bare-metal platforms.
+
\sa {Target Platforms}
\defaultvalue \l{qbs::hostPlatform}{hostPlatform}
diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs
index bc226389b..519d30f2a 100644
--- a/share/qbs/modules/cpp/iar.qbs
+++ b/share/qbs/modules/cpp/iar.qbs
@@ -54,6 +54,7 @@ CppModule {
}
qbs.architecture: iarProbe.found ? iarProbe.architecture : original
+ qbs.targetPlatform: "none"
compilerVersionMajor: iarProbe.versionMajor
compilerVersionMinor: iarProbe.versionMinor
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs
index c57eb6751..9898ecc77 100644
--- a/share/qbs/modules/cpp/keil.qbs
+++ b/share/qbs/modules/cpp/keil.qbs
@@ -52,6 +52,7 @@ CppModule {
}
qbs.architecture: keilProbe.found ? keilProbe.architecture : original
+ qbs.targetPlatform: "none"
compilerVersionMajor: keilProbe.versionMajor
compilerVersionMinor: keilProbe.versionMinor
diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs
index a8d0df3c9..793882543 100644
--- a/share/qbs/modules/cpp/sdcc.qbs
+++ b/share/qbs/modules/cpp/sdcc.qbs
@@ -52,6 +52,7 @@ CppModule {
}
qbs.architecture: sdccProbe.found ? sdccProbe.architecture : original
+ qbs.targetPlatform: "none"
compilerVersionMajor: sdccProbe.versionMajor
compilerVersionMinor: sdccProbe.versionMinor
diff --git a/tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs b/tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs
new file mode 100644
index 000000000..50be8e91a
--- /dev/null
+++ b/tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs
@@ -0,0 +1,18 @@
+Product {
+ Depends { name: "cpp" }
+ condition: {
+ if (qbs.toolchainType === "keil"
+ || qbs.toolchainType === "iar"
+ || qbs.toolchainType === "sdcc") {
+ var hasNoPlatform = (qbs.targetPlatform === "none");
+ var hasNoOS = (qbs.targetOS.length === 1 && qbs.targetOS[0] === "none");
+ console.info("has no platform: " + hasNoPlatform);
+ console.info("has no os: " + hasNoOS);
+ } else {
+ console.info("unsupported toolset: %%"
+ + qbs.toolchainType + "%%, %%" + qbs.architecture + "%%");
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.cpp b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
index 2f6169ff9..ba71ae954 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.cpp
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.cpp
@@ -52,6 +52,24 @@ TestBlackboxBareMetal::TestBlackboxBareMetal()
{
}
+void TestBlackboxBareMetal::targetPlatform()
+{
+ QDir::setCurrent(testDataDir + "/target-platform");
+ QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("-n"))), 0);
+ if (!m_qbsStdout.contains("unsupported toolset:")) {
+ const bool hasNoPlatform = m_qbsStdout.contains("has no platform: true");
+ QCOMPARE(hasNoPlatform, true);
+ const bool hasNoOS = m_qbsStdout.contains("has no os: true");
+ QCOMPARE(hasNoOS, true);
+ } else {
+ QByteArray toolchain;
+ QByteArray architecture;
+ extractUnsupportedToolset(m_qbsStdout, toolchain, architecture);
+ QSKIP("Unsupported toolchain '" + toolchain
+ + "' for architecture '" + architecture + "'");
+ }
+}
+
void TestBlackboxBareMetal::application_data()
{
QTest::addColumn<QString>("testPath");
diff --git a/tests/auto/blackbox/tst_blackboxbaremetal.h b/tests/auto/blackbox/tst_blackboxbaremetal.h
index da31002e1..f3376b0ba 100644
--- a/tests/auto/blackbox/tst_blackboxbaremetal.h
+++ b/tests/auto/blackbox/tst_blackboxbaremetal.h
@@ -41,6 +41,8 @@ public:
TestBlackboxBareMetal();
private slots:
+ void targetPlatform();
+
void application_data();
void application();