aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-12-08 16:06:36 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2017-12-11 09:23:53 +0000
commita86215cab101caa0bac1f9c70b15c62c601bb34e (patch)
tree6a312019053e7c5ffc83902ffa7c8ca29dac8dcb
parent30d724ad339e30055f72c0264833d1cd4e5f9122 (diff)
Fix GCC support for "bare metal" systems again
This was fixed before in 8176a4d419 and broken again in 72eedbb0a4. Fix it for good this time using module priorities. Task-number: QBS-1263 Change-Id: Ib1702299ef6c51b19a9082da96485ef5387dc1bb Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r--share/qbs/modules/cpp/CppModule.qbs2
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs1
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs11
-rw-r--r--share/qbs/modules/cpp/LinuxGCC.qbs3
-rw-r--r--share/qbs/modules/cpp/UnixGCC.qbs5
-rw-r--r--share/qbs/modules/cpp/android-gcc.qbs2
-rw-r--r--share/qbs/modules/cpp/genericunix-gcc.qbs36
-rw-r--r--share/qbs/modules/cpp/windows-mingw.qbs1
-rw-r--r--share/qbs/modules/cpp/windows-msvc.qbs3
-rw-r--r--tests/auto/api/testdata/fallback-gcc/fallback-gcc.qbs22
-rw-r--r--tests/auto/api/tst_api.cpp39
-rw-r--r--tests/auto/api/tst_api.h1
12 files changed, 84 insertions, 42 deletions
diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs
index c340519ac..03155ed58 100644
--- a/share/qbs/modules/cpp/CppModule.qbs
+++ b/share/qbs/modules/cpp/CppModule.qbs
@@ -337,6 +337,8 @@ Module {
property stringList targetDriverFlags
property stringList targetLinkerFlags
+ property bool _skipAllChecks: false // Internal, for testing only.
+
// TODO: The following four rules could use a convenience base item if rule properties
// were available in Artifact items and prepare scripts.
Rule {
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 33b5093ab..06658472c 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -48,6 +48,7 @@ UnixGCC {
Probes.BinaryProbe {
id: lipoProbe
+ condition: !_skipAllChecks
names: [lipoName]
platformPaths: {
var paths = (xcode.present && xcode.devicePlatformPath)
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 86fd64874..113587e60 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -41,11 +41,12 @@ import qbs.WindowsUtils
import 'gcc.js' as Gcc
CppModule {
- condition: false
+ condition: qbs.toolchain && qbs.toolchain.contains("gcc")
+ priority: -100
Probes.BinaryProbe {
id: compilerPathProbe
- condition: !toolchainInstallPath
+ condition: !toolchainInstallPath && !_skipAllChecks
names: [toolchainPrefix ? toolchainPrefix + compilerName : compilerName]
}
@@ -60,6 +61,7 @@ CppModule {
Probes.GccProbe {
id: gccProbe
+ condition: !_skipAllChecks
compilerFilePathByLanguage: compilerPathByLanguage
enableDefinesByLanguage: enableCompilerDefinesByLanguage
environment: buildEnv
@@ -69,7 +71,7 @@ CppModule {
Probes.BinaryProbe {
id: binutilsProbe
- condition: !File.exists(archiverPath)
+ condition: !File.exists(archiverPath) && !_skipAllChecks
names: Gcc.toolNames([archiverName, assemblerName, linkerName, nmName,
objcopyName, stripName], toolchainPrefix)
}
@@ -83,6 +85,7 @@ CppModule {
Probe {
id: nmProbe
+ condition: !_skipAllChecks
property string theNmPath: nmPath
property bool hasDynamicOption
configure: {
@@ -262,6 +265,8 @@ CppModule {
}
validate: {
+ if (_skipAllChecks)
+ return;
if (!File.exists(compilerPath)) {
var pathMessage = FileInfo.isAbsolutePath(compilerPath)
? "at '" + compilerPath + "'"
diff --git a/share/qbs/modules/cpp/LinuxGCC.qbs b/share/qbs/modules/cpp/LinuxGCC.qbs
index 32c45eaad..1209da15e 100644
--- a/share/qbs/modules/cpp/LinuxGCC.qbs
+++ b/share/qbs/modules/cpp/LinuxGCC.qbs
@@ -42,7 +42,8 @@ UnixGCC {
Probe {
id: runPathsProbe
- condition: qbs.targetOS.length === qbs.hostOS.length
+ condition: !_skipAllChecks
+ && qbs.targetOS.length === qbs.hostOS.length
&& qbs.targetOS.every(function(v, i) { return v === qbs.hostOS[i]; })
property stringList systemRunPaths: []
configure: {
diff --git a/share/qbs/modules/cpp/UnixGCC.qbs b/share/qbs/modules/cpp/UnixGCC.qbs
index ee5171611..491cf74af 100644
--- a/share/qbs/modules/cpp/UnixGCC.qbs
+++ b/share/qbs/modules/cpp/UnixGCC.qbs
@@ -31,7 +31,10 @@
import qbs 1.0
GenericGCC {
- condition: false
+ condition: qbs.toolchain && qbs.toolchain.contains("gcc")
+ && qbs.targetOS && qbs.targetOS.contains("unix")
+ priority: -50
+
staticLibraryPrefix: "lib"
dynamicLibraryPrefix: "lib"
loadableModulePrefix: "lib"
diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs
index cc82a5031..2c18ed02c 100644
--- a/share/qbs/modules/cpp/android-gcc.qbs
+++ b/share/qbs/modules/cpp/android-gcc.qbs
@@ -286,6 +286,8 @@ LinuxGCC {
}
validate: {
+ if (!_skipAllChecks)
+ return;
var baseValidator = new ModUtils.PropertyValidator("qbs");
baseValidator.addCustomValidator("architecture", targetArch, function (value) {
return value !== undefined;
diff --git a/share/qbs/modules/cpp/genericunix-gcc.qbs b/share/qbs/modules/cpp/genericunix-gcc.qbs
deleted file mode 100644
index 5e6a158c6..000000000
--- a/share/qbs/modules/cpp/genericunix-gcc.qbs
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** 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 1.0
-
-UnixGCC {
- condition: qbs.targetOS && qbs.targetOS.contains("unix") &&
- qbs.toolchain && qbs.toolchain.contains('gcc')
-}
diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs
index cba8044cf..4ef2ea552 100644
--- a/share/qbs/modules/cpp/windows-mingw.qbs
+++ b/share/qbs/modules/cpp/windows-mingw.qbs
@@ -37,6 +37,7 @@ import qbs.WindowsUtils
GenericGCC {
condition: qbs.targetOS.contains("windows") &&
qbs.toolchain && qbs.toolchain.contains("mingw")
+ priority: 0
staticLibraryPrefix: "lib"
dynamicLibraryPrefix: ""
executablePrefix: ""
diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs
index ba632368d..b7e88b6b2 100644
--- a/share/qbs/modules/cpp/windows-msvc.qbs
+++ b/share/qbs/modules/cpp/windows-msvc.qbs
@@ -45,12 +45,13 @@ CppModule {
Probes.BinaryProbe {
id: compilerPathProbe
- condition: !toolchainInstallPath
+ condition: !toolchainInstallPath && !_skipAllChecks
names: ["cl"]
}
Probes.MsvcProbe {
id: msvcProbe
+ condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
preferredArchitecture: qbs.architecture
diff --git a/tests/auto/api/testdata/fallback-gcc/fallback-gcc.qbs b/tests/auto/api/testdata/fallback-gcc/fallback-gcc.qbs
new file mode 100644
index 000000000..8b3b63e65
--- /dev/null
+++ b/tests/auto/api/testdata/fallback-gcc/fallback-gcc.qbs
@@ -0,0 +1,22 @@
+import qbs
+
+CppApplication {
+ name: "app"
+ cpp._skipAllChecks: true
+ Profile {
+ name: "unixProfile"
+ qbs.targetOS: ["unix"]
+ qbs.toolchain: ["gcc"]
+ // qbs.targetPlatform: "unix"
+ // qbs.toolchainType: "gcc"
+ }
+ Profile {
+ name: "gccProfile"
+ qbs.targetOS: []
+ qbs.toolchain: ["gcc"]
+ // qbs.targetPlatform: undefined
+ // qbs.toolchainType: "gcc"
+ }
+ multiplexByQbsProperties: ["profiles"]
+ qbs.profiles: ["unixProfile", "gccProfile"]
+}
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index 528714704..c0cbdebef 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -1182,6 +1182,45 @@ void TestApi::exportWithRecursiveDepends()
VERIFY_NO_ERROR(errorInfo);
}
+void TestApi::fallbackGcc()
+{
+ qbs::SetupProjectParameters setupParams
+ = defaultSetupParameters("fallback-gcc/fallback-gcc.qbs");
+ std::unique_ptr<qbs::SetupProjectJob> job(qbs::Project().setupProject(setupParams,
+ m_logSink, nullptr));
+ waitForFinished(job.get());
+ VERIFY_NO_ERROR(job->error());
+
+ qbs::ProjectData project = job->project().projectData();
+ QVERIFY(project.isValid());
+ QList<qbs::ProductData> products = project.allProducts();
+ QCOMPARE(products.size(), 2);
+ for (const qbs::ProductData &p : qAsConst(products)) {
+ if (p.profile() == "unixProfile") {
+ qbs::PropertyMap moduleProps = p.moduleProperties();
+ QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(),
+ QStringList({"unix"}));
+ QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(),
+ QStringList({"gcc"}));
+ QCOMPARE(QFileInfo(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString())
+ .completeBaseName(), QString("g++"));
+ QCOMPARE(moduleProps.getModuleProperty("cpp", "dynamicLibrarySuffix").toString(),
+ QString(".so"));
+ } else {
+ QCOMPARE(p.profile(), QString("gccProfile"));
+ qbs::PropertyMap moduleProps = p.moduleProperties();
+ QCOMPARE(moduleProps.getModuleProperty("qbs", "targetOS").toStringList(),
+ QStringList());
+ QCOMPARE(moduleProps.getModuleProperty("qbs", "toolchain").toStringList(),
+ QStringList({"gcc"}));
+ QCOMPARE(QFileInfo(moduleProps.getModuleProperty("cpp", "cxxCompilerName").toString())
+ .completeBaseName(), QString("g++"));
+ QCOMPARE(moduleProps.getModuleProperty("cpp", "dynamicLibrarySuffix").toString(),
+ QString());
+ }
+ }
+}
+
void TestApi::fileTagger()
{
BuildDescriptionReceiver receiver;
diff --git a/tests/auto/api/tst_api.h b/tests/auto/api/tst_api.h
index b70c69afb..30bd1d409 100644
--- a/tests/auto/api/tst_api.h
+++ b/tests/auto/api/tst_api.h
@@ -87,6 +87,7 @@ private slots:
void explicitlyDependsOn();
void exportSimple();
void exportWithRecursiveDepends();
+ void fallbackGcc();
void fileTagger();
void fileTagsFilterOverride();
void generatedFilesList();