diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-04-22 11:20:25 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-04-29 16:23:19 +0000 |
commit | a16582bd37475773f6c5ba7f1f643484cf5c3271 (patch) | |
tree | e5e9b4c055f4c0683b5f1e6987cdbc52dd4e33e2 /src/app/qbs-setup-toolchains/probe.cpp | |
parent | 8500d2e6586c01a4fa955afa7601746b41001ee8 (diff) |
Do extensive validation on the value of qbs.toolchain.
qbs now enforces the order of the items in the toolchain list, ensures
that there are no duplicates, and ensures that all implied values are
present in the list (for example, clang implies llvm implies gcc).
Users can now rely on appropriate values always being present (like
llvm, or gcc), and on the order of the toolchain list.
Change-Id: I9abcee9265a8ac9539639128bb4b624353c155ec
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/app/qbs-setup-toolchains/probe.cpp')
-rw-r--r-- | src/app/qbs-setup-toolchains/probe.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp index fb245c4eb..eef8dc6f7 100644 --- a/src/app/qbs-setup-toolchains/probe.cpp +++ b/src/app/qbs-setup-toolchains/probe.cpp @@ -40,6 +40,7 @@ #include <tools/profile.h> #include <tools/scripttools.h> #include <tools/settings.h> +#include <tools/toolchains.h> #include <QDir> #include <QFileInfo> @@ -97,26 +98,14 @@ static QStringList validMinGWMachines() << QLatin1String("i586-mingw32msvc") << QLatin1String("amd64-mingw32msvc"); } -static QStringList completeToolchainList(const QString &toolchainName) -{ - QStringList toolchains(toolchainName); - if (toolchainName == QLatin1String("clang")) - toolchains << completeToolchainList(QLatin1String("llvm")); - else if (toolchainName == QLatin1String("llvm") || - toolchainName == QLatin1String("mingw")) { - toolchains << completeToolchainList(QLatin1String("gcc")); - } - return toolchains; -} - static QStringList toolchainTypeFromCompilerName(const QString &compilerName) { if (compilerName == QLatin1String("cl.exe")) - return completeToolchainList(QLatin1String("msvc")); + return canonicalToolchain(QLatin1String("msvc")); foreach (const QString &type, (QStringList() << QLatin1String("clang") << QLatin1String("llvm") << QLatin1String("mingw") << QLatin1String("gcc"))) if (compilerName.contains(type)) - return completeToolchainList(type); + return canonicalToolchain(type); return QStringList(); } @@ -264,7 +253,7 @@ static void mingwProbe(Settings *settings, QList<Profile> &profiles) = findExecutable(HostOsInfo::appendExecutableSuffix(compilerName)); if (!gccPath.isEmpty()) profiles << createGccProfile(gccPath, settings, - completeToolchainList(QLatin1String("mingw"))); + canonicalToolchain(QLatin1String("mingw"))); } } @@ -309,7 +298,7 @@ void createProfile(const QString &profileName, const QString &toolchainType, if (toolchainType.isEmpty()) toolchainTypes = toolchainTypeFromCompilerName(compiler.fileName()); else - toolchainTypes = completeToolchainList(toolchainType); + toolchainTypes = canonicalToolchain(toolchainType); if (toolchainTypes.contains(QLatin1String("msvc"))) createMsvcProfile(profileName, compiler.absoluteFilePath(), settings); |