diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-02 21:30:47 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2020-08-04 16:38:41 +0000 |
commit | ec3181bb83f223b18b029d5776f427a3019f2381 (patch) | |
tree | 90e3a1c8d5475fcc1d2fd025c4f5fd722ac2fe3a | |
parent | 410ba29770614457e0d5d6b45d782967d6849b3c (diff) |
baremetal: Introduce new 'none' choosing for qbs.targetPlatform
This 'none' value should be used for a bare-metal toolchains
in the qbs.targetPlatform and the qbs.targetOS properties.
Now this value is set in the profiles during automatic detection
of such toolchains as IAR, KEIL and SDCC.
Take into account, that it is impossible to do the same and for
the GCC toolchain, because there are not exists a proper way to
know that a current GCC is for a 'bare-metal'. So, the users
should change the qbs.targetPlatform manually.
Change-Id: I178fd526bbb5ae44f18e35ff12970ed0718c476d
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | doc/reference/modules/qbs-module.qdoc | 5 | ||||
-rw-r--r-- | share/qbs/modules/cpp/iar.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/keil.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/sdcc.qbs | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-baremetal/target-platform/target-platform.qbs | 18 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbaremetal.cpp | 18 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbaremetal.h | 2 |
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(); |