aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2016-11-30 12:15:05 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2016-11-30 12:52:14 +0000
commit26c5cbc1f616f2b8c63f8ee30af6face091da314 (patch)
treea1342935397fa42f9bb85000fd9147535dd15f02
parentc295cd95c6bfcdcc33007668996c9cf93870d6ce (diff)
Prepare VS Qt version matching for VS 2017
Comparing major versions is not enough for VS 2017 since its compiler has the version number 19.1. Change-Id: I689e2d5399661ed7fe323eea0215d92ea4560e1a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp36
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp2
2 files changed, 19 insertions, 19 deletions
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index b7334afa7..9314c69aa 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -411,38 +411,38 @@ static bool isMsvcQt(const QtEnvironment &env)
return env.mkspecName.startsWith(msvcPrefix);
}
-static int msvcCompilerMajorVersionForYear(int year)
+static Version msvcCompilerVersionForYear(int year)
{
switch (year)
{
case 2005:
- return 14;
+ return Version(14);
case 2008:
- return 15;
+ return Version(15);
case 2010:
- return 16;
+ return Version(16);
case 2012:
- return 17;
+ return Version(17);
case 2013:
- return 18;
+ return Version(18);
case 2015:
- return 19;
+ return Version(19);
default:
- return 0;
+ return Version();
}
}
-static int msvcCompilerMajorVersionForYear(const QtEnvironment &env)
+static Version msvcCompilerVersionForYear(const QtEnvironment &env)
{
return isMsvcQt(env)
- ? msvcCompilerMajorVersionForYear(env.mkspecName.mid(msvcPrefix.size()).toInt())
- : 0;
+ ? msvcCompilerVersionForYear(env.mkspecName.mid(msvcPrefix.size()).toInt())
+ : Version();
}
enum Match { MatchFull, MatchPartial, MatchNone };
static Match compatibility(const QtEnvironment &env, const Profile &toolchainProfile,
- int msvcCompilerVersionMajor)
+ const Version &msvcCompilerVersion)
{
Match match = MatchFull;
@@ -470,11 +470,11 @@ static Match compatibility(const QtEnvironment &env, const Profile &toolchainPro
canonicalArchitecture(toolchainArchitecture)))
return MatchNone;
- if (msvcCompilerVersionMajor) {
+ if (msvcCompilerVersion.isValid()) {
// We want to know for sure that MSVC compiler versions match,
// because it's especially important for this toolchain
- if (msvcCompilerVersionMajor == 0 || msvcCompilerVersionMajor !=
- toolchainProfile.value(QLatin1String("cpp.compilerVersionMajor"))) {
+ if (msvcCompilerVersion != Version::fromString(
+ toolchainProfile.value(QLatin1String("cpp.compilerVersion")).toString())) {
return MatchNone;
}
}
@@ -519,7 +519,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
QStringList fullMatches;
QStringList partialMatches;
- const int msvcCompilerVersionMajor = msvcCompilerMajorVersionForYear(qtEnvironment);
+ const Version msvcCompilerVersion = msvcCompilerVersionForYear(qtEnvironment);
foreach (const QString &profileName, settings->profiles()) {
const Profile otherProfile(profileName, settings);
if (profileName == profile.name()
@@ -527,7 +527,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
|| isQtProfile(otherProfile))
continue;
- switch (compatibility(qtEnvironment, otherProfile, msvcCompilerVersionMajor)) {
+ switch (compatibility(qtEnvironment, otherProfile, msvcCompilerVersion)) {
case MatchFull:
fullMatches << profileName;
break;
@@ -539,7 +539,7 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
}
}
- if (msvcCompilerVersionMajor && fullMatches.size() > 1)
+ if (msvcCompilerVersion.isValid() && fullMatches.size() > 1)
compressMsvcProfiles(fullMatches);
QString bestMatch;
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index 716d0aaee..e956b20bc 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -76,7 +76,7 @@ static void setQtHelperProperties(Profile &p, const MSVC *msvc)
targetArch = QStringLiteral("armv7");
p.setValue(QStringLiteral("qbs.architecture"), canonicalArchitecture(targetArch));
- p.setValue(QStringLiteral("cpp.compilerVersionMajor"), msvc->compilerVersion.majorVersion());
+ p.setValue(QStringLiteral("cpp.compilerVersion"), msvc->compilerVersion.toString());
}
static void addMSVCPlatform(Settings *settings, QList<Profile> &profiles, QString name, MSVC *msvc)