summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-16 23:16:25 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-16 23:16:25 +0200
commitd148019f16e3c95916731e59e0324e7c470cc1fc (patch)
treed9c0640c9055f24379468b8f55b3419f30a37c47 /tools
parent8ceab12814a7437a01d917c83ec28fd6e81c459e (diff)
parent6b9c57f8cd3df65702db327616913fa9d8172237 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configureapp.cpp10
-rw-r--r--tools/configure/environment.cpp24
-rw-r--r--tools/configure/environment.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 0fa205bd98..263cd6e78c 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -304,6 +304,12 @@ Configure::Configure(int& argc, char** argv) : verbose(0)
dictionary["QT_GCC_MAJOR_VERSION"] = parts.value(0, zero);
dictionary["QT_GCC_MINOR_VERSION"] = parts.value(1, zero);
dictionary["QT_GCC_PATCH_VERSION"] = parts.value(2, zero);
+ } else if (dictionary["QMAKESPEC"].contains(QString("msvc"))) {
+ const QString zero = QStringLiteral("0");
+ const QStringList parts = Environment::msvcVersion().split(QLatin1Char('.'));
+ dictionary["QT_CL_MAJOR_VERSION"] = parts.value(0, zero);
+ dictionary["QT_CL_MINOR_VERSION"] = parts.value(1, zero);
+ dictionary["QT_CL_PATCH_VERSION"] = parts.value(2, zero);
}
}
@@ -3553,6 +3559,10 @@ void Configure::generateQConfigPri()
configStream << "QT_GCC_MAJOR_VERSION = " << dictionary["QT_GCC_MAJOR_VERSION"] << endl
<< "QT_GCC_MINOR_VERSION = " << dictionary["QT_GCC_MINOR_VERSION"] << endl
<< "QT_GCC_PATCH_VERSION = " << dictionary["QT_GCC_PATCH_VERSION"] << endl;
+ } else if (!dictionary["QT_CL_MAJOR_VERSION"].isEmpty()) {
+ configStream << "QT_CL_MAJOR_VERSION = " << dictionary["QT_CL_MAJOR_VERSION"] << endl
+ << "QT_CL_MINOR_VERSION = " << dictionary["QT_CL_MINOR_VERSION"] << endl
+ << "QT_CL_PATCH_VERSION = " << dictionary["QT_CL_PATCH_VERSION"] << endl;
}
if (dictionary.value("XQMAKESPEC").startsWith("wince")) {
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 5189883901..1a05c9ce62 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -147,6 +147,30 @@ QString Environment::gccVersion()
return version;
}
+QString Environment::msvcVersion()
+{
+ int returnValue = 0;
+ // Extract version from standard error output of "cl /?"
+ const QString command = QFile::decodeName(qgetenv("ComSpec"))
+ + QLatin1String(" /c ") + QLatin1String(compilerInfo(CC_MSVC2015)->executable)
+ + QLatin1String(" /? 2>&1");
+ QString version = execute(command, &returnValue);
+ if (returnValue != 0) {
+ cout << "Could not get cl version" << returnValue << qPrintable(version) << '\n';;
+ version.clear();
+ } else {
+ QRegExp versionRegexp(QStringLiteral("^.*Compiler Version ([0-9.]+) for.*$"));
+ Q_ASSERT(versionRegexp.isValid());
+ if (versionRegexp.exactMatch(version)) {
+ version = versionRegexp.cap(1);
+ } else {
+ cout << "Unable to determine cl version from the output of \""
+ << qPrintable(command) << "\"\n";
+ }
+ }
+ return version;
+}
+
/*!
Returns the enum of the compiler which was detected on the system.
The compilers are detected in the order as entered into the
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
index 893e33c76f..344404505e 100644
--- a/tools/configure/environment.h
+++ b/tools/configure/environment.h
@@ -52,6 +52,7 @@ public:
static QString detectQMakeSpec();
static Compiler compilerFromQMakeSpec(const QString &qmakeSpec);
static QString gccVersion();
+ static QString msvcVersion();
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
static QString execute(const QString &command, int *returnCode = 0);