aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-02-23 17:59:57 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-03-09 10:13:15 +0000
commit1b3f4b0ac80c0b66eef2c03df4c4385044aa7ba6 (patch)
tree1dabf07cc3f30f42f97272818c83ab61b3e2fe51 /src
parent16e4b2e6d6a3bce11ce7e021c1fb40194e3fb8dd (diff)
setup-toolchains now sets the qbs.toolchainType, not qbs.toolchain
Change-Id: I21f0626a093db358f8f5dfa6248672c44edc82e2 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp12
-rw-r--r--src/app/qbs-setup-toolchains/clangclprobe.cpp4
-rw-r--r--src/app/qbs-setup-toolchains/gccprobe.cpp20
-rw-r--r--src/app/qbs-setup-toolchains/gccprobe.h2
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp2
-rw-r--r--src/app/qbs-setup-toolchains/probe.cpp39
-rw-r--r--src/app/qbs-setup-toolchains/probe.h2
-rw-r--r--src/app/qbs-setup-toolchains/xcodeprobe.cpp6
8 files changed, 43 insertions, 44 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index 947cbc5fc..07e1a81b5 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -47,6 +47,7 @@
#include <tools/set.h>
#include <tools/settings.h>
#include <tools/stlutils.h>
+#include <tools/toolchains.h>
#include <tools/version.h>
#include <QtCore/qbytearraymatcher.h>
@@ -196,7 +197,7 @@ static bool isToolchainProfile(const Profile &profile)
{
const auto actual = Internal::Set<QString>::fromList(
profile.allKeys(Profile::KeySelectionRecursive));
- Internal::Set<QString> expected = Internal::Set<QString> { QStringLiteral("qbs.toolchain") };
+ Internal::Set<QString> expected{ QStringLiteral("qbs.toolchainType") };
if (HostOsInfo::isMacosHost())
expected.insert(QStringLiteral("qbs.targetPlatform")); // match only Xcode profiles
return Internal::Set<QString>(actual).unite(expected) == actual;
@@ -230,8 +231,13 @@ static Match compatibility(const QtEnvironment &env, const Profile &toolchainPro
{
Match match = MatchFull;
- const auto toolchainNames = Internal::Set<QString>::fromList(
- toolchainProfile.value(QStringLiteral("qbs.toolchain")).toStringList());
+ const auto toolchainType =
+ toolchainProfile.value(QStringLiteral("qbs.toolchainType")).toString();
+ const auto toolchain = !toolchainType.isEmpty()
+ ? canonicalToolchain(toolchainType)
+ : toolchainProfile.value(QStringLiteral("qbs.toolchain")).toStringList();
+
+ const auto toolchainNames = Internal::Set<QString>::fromList(toolchain);
const auto qtToolchainNames = Internal::Set<QString>::fromList(env.qbsToolchain);
if (areProfilePropertiesIncompatible(toolchainNames, qtToolchainNames)) {
auto intersection = toolchainNames;
diff --git a/src/app/qbs-setup-toolchains/clangclprobe.cpp b/src/app/qbs-setup-toolchains/clangclprobe.cpp
index 6eff83217..a36ded768 100644
--- a/src/app/qbs-setup-toolchains/clangclprobe.cpp
+++ b/src/app/qbs-setup-toolchains/clangclprobe.cpp
@@ -75,9 +75,7 @@ Profile createProfileHelper(
Profile profile(profileName, settings);
profile.removeProfile();
profile.setValue(QStringLiteral("qbs.architecture"), architecture);
- profile.setValue(
- QStringLiteral("qbs.toolchain"),
- QStringList{QStringLiteral("clang-cl"), QStringLiteral("msvc")});
+ profile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("clang-cl"));
profile.setValue(QStringLiteral("cpp.toolchainInstallPath"), toolchainInstallPath);
profile.setValue(QStringLiteral("cpp.vcvarsallPath"), vcvarsallPath);
qbsInfo() << Tr::tr("Profile '%1' created for '%2'.")
diff --git a/src/app/qbs-setup-toolchains/gccprobe.cpp b/src/app/qbs-setup-toolchains/gccprobe.cpp
index 86e5e5d2e..df3f92f62 100644
--- a/src/app/qbs-setup-toolchains/gccprobe.cpp
+++ b/src/app/qbs-setup-toolchains/gccprobe.cpp
@@ -138,9 +138,9 @@ public:
};
static void setCommonProperties(Profile &profile, const QFileInfo &compiler,
- const QStringList &toolchainTypes, const ToolchainDetails &details)
+ const QString &toolchainType, const ToolchainDetails &details)
{
- if (toolchainTypes.contains(QStringLiteral("mingw")))
+ if (toolchainType == QStringLiteral("mingw"))
profile.setValue(QStringLiteral("qbs.targetPlatform"),
QStringLiteral("windows"));
@@ -149,7 +149,7 @@ static void setCommonProperties(Profile &profile, const QFileInfo &compiler,
profile.setValue(QStringLiteral("cpp.toolchainInstallPath"),
compiler.absolutePath());
- profile.setValue(QStringLiteral("qbs.toolchain"), toolchainTypes);
+ profile.setValue(QStringLiteral("qbs.toolchainType"), toolchainType);
if (!standardCompilerFileNames().contains(
HostOsInfo::appendExecutableSuffix(details.suffix))) {
@@ -453,12 +453,12 @@ static QStringList mplabX32RegistrySearchPaths()
}
Profile createGccProfile(const QFileInfo &compiler, Settings *settings,
- const QStringList &toolchainTypes,
+ const QString &toolchainType,
const QString &profileName)
{
const QString machineName = gccMachineName(compiler);
- if (toolchainTypes.contains(QLatin1String("mingw"))) {
+ if (toolchainType == QLatin1String("mingw")) {
if (!validMinGWMachines().contains(machineName)) {
throw ErrorInfo(Tr::tr("Detected gcc platform '%1' is not supported.")
.arg(machineName));
@@ -470,9 +470,9 @@ Profile createGccProfile(const QFileInfo &compiler, Settings *settings,
const ToolchainDetails details(compiler);
- setCommonProperties(profile, compiler, toolchainTypes, details);
+ setCommonProperties(profile, compiler, toolchainType, details);
- if (HostOsInfo::isWindowsHost() && toolchainTypes.contains(QLatin1String("clang"))) {
+ if (HostOsInfo::isWindowsHost() && toolchainType == QLatin1String("clang")) {
const QStringList profileNames = settings->profiles();
bool foundMingw = false;
for (const QString &profileName : profileNames) {
@@ -497,7 +497,7 @@ Profile createGccProfile(const QFileInfo &compiler, Settings *settings,
}
}
- if (!toolchainTypes.contains(QLatin1String("clang"))) {
+ if (toolchainType != QLatin1String("clang")) {
// Check whether auxiliary tools reside within the toolchain's install path.
// This might not be the case when using icecc or another compiler wrapper.
const QString compilerDirPath = compiler.absolutePath();
@@ -582,12 +582,12 @@ void gccProbe(Settings *settings, std::vector<Profile> &profiles, const QString
}
for (const auto &candidate : qAsConst(candidates)) {
- const QStringList toolchainTypes = toolchainTypeFromCompilerName(
+ const QString toolchainType = toolchainTypeFromCompilerName(
candidate.baseName());
const QString profileName = buildProfileName(candidate);
try {
auto profile = createGccProfile(candidate, settings,
- toolchainTypes, profileName);
+ toolchainType, profileName);
profiles.push_back(std::move(profile));
} catch (const qbs::ErrorInfo &info) {
qbsWarning() << Tr::tr("Skipping %1: %2").arg(profileName, info.toString());
diff --git a/src/app/qbs-setup-toolchains/gccprobe.h b/src/app/qbs-setup-toolchains/gccprobe.h
index ae389dafc..98e7eaa1f 100644
--- a/src/app/qbs-setup-toolchains/gccprobe.h
+++ b/src/app/qbs-setup-toolchains/gccprobe.h
@@ -53,7 +53,7 @@ class Settings;
qbs::Profile createGccProfile(const QFileInfo &compiler,
qbs::Settings *settings,
- const QStringList &toolchainTypes,
+ const QString &toolchainType,
const QString &profileName = QString());
void gccProbe(qbs::Settings *settings, std::vector<qbs::Profile> &profiles,
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index 8cf1d4de1..bb54add9f 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -88,7 +88,7 @@ static void addMSVCPlatform(Settings *settings, std::vector<Profile> &profiles,
Profile p(std::move(name), settings);
p.removeProfile();
p.setValue(QStringLiteral("qbs.targetPlatform"), QStringLiteral("windows"));
- p.setValue(QStringLiteral("qbs.toolchain"), QStringList(QStringLiteral("msvc")));
+ p.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("msvc"));
p.setValue(QStringLiteral("cpp.toolchainInstallPath"), msvc->binPath);
setQtHelperProperties(p, msvc);
profiles.push_back(p);
diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp
index 4c26e8d60..add7ba05c 100644
--- a/src/app/qbs-setup-toolchains/probe.cpp
+++ b/src/app/qbs-setup-toolchains/probe.cpp
@@ -97,26 +97,26 @@ QString findExecutable(const QString &fileName)
return {};
}
-QStringList toolchainTypeFromCompilerName(const QString &compilerName)
+QString toolchainTypeFromCompilerName(const QString &compilerName)
{
if (compilerName == QLatin1String("cl.exe"))
- return canonicalToolchain(QStringLiteral("msvc"));
+ return QStringLiteral("msvc");
if (compilerName == QLatin1String("clang-cl.exe"))
- return canonicalToolchain(QLatin1String("clang-cl"));
+ return QStringLiteral("clang-cl");
const auto types = { QStringLiteral("clang"), QStringLiteral("llvm"),
QStringLiteral("mingw"), QStringLiteral("gcc") };
for (const auto &type : types) {
if (compilerName.contains(type))
- return canonicalToolchain(type);
+ return type;
}
if (compilerName == QLatin1String("g++"))
- return canonicalToolchain(QStringLiteral("gcc"));
+ return QStringLiteral("gcc");
if (isIarCompiler(compilerName))
- return canonicalToolchain(QStringLiteral("iar"));
+ return QStringLiteral("iar");
if (isKeilCompiler(compilerName))
- return canonicalToolchain(QStringLiteral("keil"));
+ return QStringLiteral("keil");
if (isSdccCompiler(compilerName))
- return canonicalToolchain(QStringLiteral("sdcc"));
+ return QStringLiteral("sdcc");
return {};
}
@@ -158,23 +158,22 @@ void createProfile(const QString &profileName, const QString &toolchainType,
.arg(compilerFilePath));
}
- QStringList toolchainTypes;
- if (toolchainType.isEmpty())
- toolchainTypes = toolchainTypeFromCompilerName(compiler.fileName());
- else
- toolchainTypes = canonicalToolchain(toolchainType);
+ const QString realToolchainType = !toolchainType.isEmpty()
+ ? toolchainType
+ : toolchainTypeFromCompilerName(compiler.fileName());
+ const QStringList toolchain = canonicalToolchain(realToolchainType);
- if (toolchainTypes.contains(QLatin1String("msvc")))
+ if (toolchain.contains(QLatin1String("msvc")))
createMsvcProfile(compiler, settings, profileName);
- else if (toolchainTypes.contains(QLatin1String("clang-cl")))
+ else if (toolchain.contains(QLatin1String("clang-cl")))
createClangClProfile(compiler, settings, profileName);
- else if (toolchainTypes.contains(QLatin1String("gcc")))
- createGccProfile(compiler, settings, toolchainTypes, profileName);
- else if (toolchainTypes.contains(QLatin1String("iar")))
+ else if (toolchain.contains(QLatin1String("gcc")))
+ createGccProfile(compiler, settings, realToolchainType, profileName);
+ else if (toolchain.contains(QLatin1String("iar")))
createIarProfile(compiler, settings, profileName);
- else if (toolchainTypes.contains(QLatin1String("keil")))
+ else if (toolchain.contains(QLatin1String("keil")))
createKeilProfile(compiler, settings, profileName);
- else if (toolchainTypes.contains(QLatin1String("sdcc")))
+ else if (toolchain.contains(QLatin1String("sdcc")))
createSdccProfile(compiler, settings, profileName);
else
throw qbs::ErrorInfo(Tr::tr("Cannot create profile: Unknown toolchain type."));
diff --git a/src/app/qbs-setup-toolchains/probe.h b/src/app/qbs-setup-toolchains/probe.h
index 235d7a899..bce150bd7 100644
--- a/src/app/qbs-setup-toolchains/probe.h
+++ b/src/app/qbs-setup-toolchains/probe.h
@@ -57,7 +57,7 @@ QStringList systemSearchPaths();
QString findExecutable(const QString &fileName);
-QStringList toolchainTypeFromCompilerName(const QString &compilerName);
+QString toolchainTypeFromCompilerName(const QString &compilerName);
void createProfile(const QString &profileName, const QString &toolchainType,
const QString &compilerFilePath, qbs::Settings *settings);
diff --git a/src/app/qbs-setup-toolchains/xcodeprobe.cpp b/src/app/qbs-setup-toolchains/xcodeprobe.cpp
index 3ac243028..97b043f92 100644
--- a/src/app/qbs-setup-toolchains/xcodeprobe.cpp
+++ b/src/app/qbs-setup-toolchains/xcodeprobe.cpp
@@ -172,11 +172,7 @@ void XcodeProbe::setupDefaultToolchains(const QString &devPath, const QString &x
Profile installationProfile(xcodeName, settings);
installationProfile.removeProfile();
- installationProfile.setValue(QStringLiteral("qbs.toolchain"), QStringList()
- << QStringLiteral("xcode")
- << QStringLiteral("clang")
- << QStringLiteral("llvm")
- << QStringLiteral("gcc"));
+ installationProfile.setValue(QStringLiteral("qbs.toolchainType"), QStringLiteral("xcode"));
if (devPath != defaultDeveloperPath)
installationProfile.setValue(QStringLiteral("xcode.developerPath"), devPath);
profiles.push_back(installationProfile);