From 21b8eb121c1ef1721612c21388f802fb8b7da9e3 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 17 Nov 2016 10:40:44 +0100 Subject: [PATCH] qmake: Add support for Visual Studio 2017 Change-Id: I21f56edca3852b52edd2c5fdcce76817141e8d4a (cherry picked from qtbase/38675e18fcc841228141568a2ecfafdeb99eba2a) Reviewed-by: Joerg Bornemann Reviewed-by: Tobias Hunger --- src/shared/proparser/qmakeevaluator.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/shared/proparser/qmakeevaluator.cpp b/src/shared/proparser/qmakeevaluator.cpp index 5e318b170d8..702ec650c4d 100644 --- a/src/shared/proparser/qmakeevaluator.cpp +++ b/src/shared/proparser/qmakeevaluator.cpp @@ -968,6 +968,13 @@ static ProString msvcBinDirToQMakeArch(QString subdir) subdir = subdir.toLower(); if (subdir == QLatin1String("amd64")) return ProString("x86_64"); + // Since 2017 the folder structure from here is HostX64|X86/x64|x86 + idx = subdir.indexOf(QLatin1Char('\\')); + if (idx == -1) + return ProString("x86"); + subdir.remove(0, idx + 1); + if (subdir == QLatin1String("x64")) + return ProString("x86_64"); return ProString(subdir); } @@ -1062,8 +1069,12 @@ void QMakeEvaluator::loadDefaults() vars[ProKey("QMAKE_HOST.arch")] << archStr; # if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake + // Since VS 2017 we need VCToolsInstallDir instead of VCINSTALLDIR + QString vcInstallDir = m_option->getEnv(QLatin1String("VCToolsInstallDir")); + if (vcInstallDir.isEmpty()) + vcInstallDir = m_option->getEnv(QLatin1String("VCINSTALLDIR")); vars[ProKey("QMAKE_TARGET.arch")] = msvcArchitecture( - m_option->getEnv(QLatin1String("VCINSTALLDIR")), + vcInstallDir, m_option->getEnv(QLatin1String("PATH"))); # endif #elif defined(Q_OS_UNIX)