From 29a929668b832a3fceda69a5c5f2d07b796a3fc8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Dec 2016 16:23:47 +0100 Subject: Fix capitalization of This tag was never spelled "PlatformToolSet". The correct spelling is "PlatformToolset" (lower case s). VS itself can load qmake-generated projects despite this misspelling, but tools like PVS-Studio are bothered by it. Task-number: QTBUG-57435 Task-number: QTBUG-57694 Change-Id: Ib70e8561f1827e195194bcf518445b2909a8d8c0 Reviewed-by: Jake Petroules --- qmake/generators/win32/msbuild_objectmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 914505a362..a0050c9f1f 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -176,7 +176,7 @@ const char _Optimization[] = "Optimization"; const char _OptimizeReferences[] = "OptimizeReferences"; const char _OutputDirectory[] = "OutputDirectory"; const char _OutputFile[] = "OutputFile"; -const char _PlatformToolSet[] = "PlatformToolSet"; +const char _PlatformToolSet[] = "PlatformToolset"; const char _PrecompiledHeader[] = "PrecompiledHeader"; const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile"; const char _PrecompiledHeaderOutputFile[] = "PrecompiledHeaderOutputFile"; -- cgit v1.2.3 From 5fc2337d740963d019a1e31960a4d12dfec36ea9 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 19 Dec 2016 18:56:43 +0100 Subject: Fix unnecessary regeneration of mocables in VS projects Change dcd2f829 introduced fake files with the extension .cbt for custom build tools that generate code from C++ source inputs. The moc_predefs.h header file falls into this category, because it is generated from dummy.cpp. It turns out that these fake files have to exist. Otherwise the custom build step is executed on every build. That means re-moccing all mocables on every build. Fix this by actually creating the fake .cbt files with some explanatory comment in them. Task-number: QTBUG-57695 Change-Id: I251294334425d9914677787d8ba6da1169b4cca5 Reviewed-by: Oswald Buddenhagen Reviewed-by: Oliver Wolff --- qmake/generators/win32/msvc_vcproj.cpp | 25 +++++++++++++++++++++---- qmake/generators/win32/msvc_vcproj.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 8a77bbe672..ae1d095629 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -766,6 +766,21 @@ bool VcprojGenerator::hasBuiltinCompiler(const QString &file) return false; } +void VcprojGenerator::createCustomBuildToolFakeFile(const QString &cbtFilePath, + const QString &realOutFilePath) +{ + QFile file(fileFixify(cbtFilePath, FileFixifyFromOutdir | FileFixifyAbsolute)); + if (file.exists()) + return; + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + warn_msg(WarnLogic, "Cannot create '%s'.", qPrintable(file.fileName())); + return; + } + file.write("This is a dummy file needed to create "); + file.write(qPrintable(realOutFilePath)); + file.write("\n"); +} + void VcprojGenerator::init() { is64Bit = (project->first("QMAKE_TARGET.arch") == "x86_64"); @@ -893,12 +908,14 @@ void VcprojGenerator::init() if (!hasBuiltinCompiler(file)) { extraCompilerSources[file] += quc.toQString(); } else { - // Use a fake file name foo.moc.cbt for the project view. + // Create a fake file foo.moc.cbt for the project view. // This prevents VS from complaining about a circular // dependency from foo.moc -> foo.moc. - QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables( - compiler_out, file, QString(), NoShell), false); - out += customBuildToolFilterFileSuffix; + QString realOut = replaceExtraCompilerVariables( + compiler_out, file, QString(), NoShell); + QString out = realOut + customBuildToolFilterFileSuffix; + createCustomBuildToolFakeFile(out, realOut); + out = Option::fixPathToTargetOS(out, false); extraCompilerSources[out] += quc.toQString(); extraCompilerOutputs[out] = file; } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index e3e67d64b9..4882296b46 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -130,6 +130,7 @@ private: bool isStandardSuffix(const QString &suffix) const; ProString firstInputFileName(const ProString &extraCompilerName) const; QString firstExpandedOutputFileName(const ProString &extraCompilerName); + void createCustomBuildToolFakeFile(const QString &cbtFilePath, const QString &realOutFilePath); friend class VCFilter; }; -- cgit v1.2.3 From 88a02c4d6342d092edf3114420e9153c52c90294 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 20 Dec 2016 11:39:22 +0100 Subject: Remove ToolsVersion from generated VS projects for VS >= 2013 Before VS 2013 ToolsVersion contained a .NET version number (e.g. "4.0"). Since VS 2013 ToolsVersion is the same as the Visual Studio version number (e.g. "12.0"), which is also the default. We always wrote "4.0" (except in one special case which used "14.0"). This doesn't bother Visual Studio itself, but other tools like PVS-Studio. Remove the ToolsVersion attribute from generated VS projects for VS 2013 and newer. Task-number: QTBUG-57694 Change-Id: I7a3bc4534c492e9540f6b968bee8a969980df63f Reviewed-by: Jake Petroules Reviewed-by: Oliver Wolff Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msbuild_objectmodel.cpp | 18 +++++++++++------- qmake/generators/win32/msbuild_objectmodel.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index a0050c9f1f..e42b823598 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -406,7 +406,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) xml << decl("1.0", "utf-8") << tag("Project") << attrTag("DefaultTargets","Build") - << attrTag("ToolsVersion", "4.0") + << attrTagToolsVersion(tool.Configuration) << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") << tag("ItemGroup") << attrTag("Label", "ProjectConfigurations"); @@ -550,7 +550,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) xmlFilter << decl("1.0", "utf-8") << tag("Project") - << attrTag("ToolsVersion", "4.0") + << attrTagToolsVersion(tool.Configuration) << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); xmlFilter << tag("ItemGroup"); @@ -603,13 +603,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) xml.setIndentString(" "); - const QString toolsVersion = (tool.SdkVersion == QLatin1String("10.0")) ? QStringLiteral("14.0") - : QStringLiteral("4.0"); - xml << decl("1.0", "utf-8") << tag("Project") << attrTag("DefaultTargets","Build") - << attrTag("ToolsVersion", toolsVersion) + << attrTagToolsVersion(tool.SingleProjects.first().Configuration) << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003") << tag("ItemGroup") << attrTag("Label", "ProjectConfigurations"); @@ -796,7 +793,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) xmlFilter << decl("1.0", "utf-8") << tag("Project") - << attrTag("ToolsVersion", "4.0") + << attrTagToolsVersion(tool.SingleProjects.first().Configuration) << attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); xmlFilter << tag("ItemGroup"); @@ -2056,4 +2053,11 @@ QString VCXProjectWriter::generateCondition(const VCConfiguration &config) return QStringLiteral("'$(Configuration)|$(Platform)'=='") + config.Name + QLatin1Char('\''); } +XmlOutput::xml_output VCXProjectWriter::attrTagToolsVersion(const VCConfiguration &config) +{ + if (config.CompilerVersion >= NET2013) + return noxml(); + return attrTag("ToolsVersion", "4.0"); +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index d594fbaca8..4bec517fa6 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -185,6 +185,7 @@ private: bool fileAdded, bool hasCustomBuildStep); static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName); static QString generateCondition(const VCConfiguration &config); + static XmlOutput::xml_output attrTagToolsVersion(const VCConfiguration &config); friend class XTreeNode; friend class XFlatNode; -- cgit v1.2.3 From 9b68bc4147e1a8e61cbe0b5e318001fd6b76c7be Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Nov 2016 11:42:35 +0100 Subject: move "shared" registry reading code into qmake now that configureapp does not use it any more, qmake is the only remaining user. and the license headers already claimed that this code is part of qmake ... Change-Id: I9b8a16f8f2b432d2b1143efbdd1f0042305ccc0c Reviewed-by: Thiago Macieira --- qmake/generators/win32/msvc_nmake.cpp | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 2 +- qmake/generators/win32/registry.cpp | 158 +++++++++++++++++++++++++++++++++ qmake/generators/win32/registry_p.h | 73 +++++++++++++++ 4 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 qmake/generators/win32/registry.cpp create mode 100644 qmake/generators/win32/registry_p.h (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index da10b1984f..5b5eecd373 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index ae1d095629..ef4e9f29b6 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -61,7 +61,7 @@ QT_END_NAMESPACE #ifdef Q_OS_WIN32 #include -#include +#include QT_BEGIN_NAMESPACE diff --git a/qmake/generators/win32/registry.cpp b/qmake/generators/win32/registry.cpp new file mode 100644 index 0000000000..74c912ca43 --- /dev/null +++ b/qmake/generators/win32/registry.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "registry_p.h" + +QT_BEGIN_NAMESPACE + +#ifdef Q_OS_WIN32 +/*! + Returns the path part of a registry key. + e.g. + For a key + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir" + it returns + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\" +*/ +static QString keyPath(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return QString(); + return rKey.left(idx + 1); +} + +/*! + Returns the name part of a registry key. + e.g. + For a key + "Software\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir" + it returns + "ProductDir" +*/ +static QString keyName(const QString &rKey) +{ + int idx = rKey.lastIndexOf(QLatin1Char('\\')); + if (idx == -1) + return rKey; + + QString res(rKey.mid(idx + 1)); + if (res == QLatin1String("Default") || res == QLatin1String(".")) + res = QString(); + return res; +} +#endif + +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned long options) +{ + QString result; + +#ifdef Q_OS_WIN32 + QString rSubkeyName = keyName(rSubkey); + QString rSubkeyPath = keyPath(rSubkey); + + HKEY handle = 0; + LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, + KEY_READ | options, &handle); + + if (res != ERROR_SUCCESS) + return QString(); + + // get the size and type of the value + DWORD dataType; + DWORD dataSize; + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); + if (res != ERROR_SUCCESS) { + RegCloseKey(handle); + return QString(); + } + + // get the value + QByteArray data(dataSize, 0); + res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, + reinterpret_cast(data.data()), &dataSize); + if (res != ERROR_SUCCESS) { + RegCloseKey(handle); + return QString(); + } + + switch (dataType) { + case REG_EXPAND_SZ: + case REG_SZ: { + result = QString::fromWCharArray(((const wchar_t *)data.constData())); + break; + } + + case REG_MULTI_SZ: { + QStringList l; + int i = 0; + for (;;) { + QString s = QString::fromWCharArray((const wchar_t *)data.constData() + i); + i += s.length() + 1; + + if (s.isEmpty()) + break; + l.append(s); + } + result = l.join(QLatin1String(", ")); + break; + } + + case REG_NONE: + case REG_BINARY: { + result = QString::fromWCharArray((const wchar_t *)data.constData(), data.size() / 2); + break; + } + + case REG_DWORD_BIG_ENDIAN: + case REG_DWORD: { + Q_ASSERT(data.size() == sizeof(int)); + int i; + memcpy((char*)&i, data.constData(), sizeof(int)); + result = QString::number(i); + break; + } + + default: + qWarning("QSettings: unknown data %u type in windows registry", quint32(dataType)); + break; + } + + RegCloseKey(handle); +#else + Q_UNUSED(parentHandle); + Q_UNUSED(rSubkey) + Q_UNUSED(options); +#endif + + return result; +} + +QT_END_NAMESPACE + diff --git a/qmake/generators/win32/registry_p.h b/qmake/generators/win32/registry_p.h new file mode 100644 index 0000000000..3526dffd45 --- /dev/null +++ b/qmake/generators/win32/registry_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the qmake application of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_WINDOWS_REGISTRY_H +#define QT_WINDOWS_REGISTRY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +#include + +#ifdef Q_OS_WIN32 + #include +#else + typedef void* HKEY; +#endif + +#include + +/** + * Read a value from the Windows registry. + * + * If the key is not found, or the registry cannot be accessed (for example + * if this code is compiled for a platform other than Windows), a null + * string is returned. + * + * 32-bit code reads from the registry's 32 bit view (Wow6432Node), + * 64 bit code reads from the 64 bit view. + * Pass KEY_WOW64_32KEY to access the 32 bit view regardless of the + * application's architecture, KEY_WOW64_64KEY respectively. + */ +QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, + unsigned long options = 0); + +QT_END_NAMESPACE + +#endif // QT_WINDOWS_REGISTRY_H + -- cgit v1.2.3 From 8b64f9336255fa17f1b8e5f337d0e79765512150 Mon Sep 17 00:00:00 2001 From: Andrew Patterson Date: Wed, 4 Jan 2017 15:29:16 -0500 Subject: Ensure that RC_FILE is correctly handled in a single configuration When generating the Visual Studio project XML, the filter "Root Files" was not being output. Specifically, this means that even if RC_FILE was specified, it would not be included properly as a resource compilation target in the resultant Visual Studio project file. This is essentially a rather belated cherry-pick of qt/d6de960b7f. Task-number: QTBUG-57914 Change-Id: I7d03dc818df0cf36608012f1a71a3a476d8a9ff7 Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msbuild_objectmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index e42b823598..9cc125d396 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -587,6 +587,8 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) outputFilter(tempProj, xml, xmlFilter, tempProj.ExtraCompilers.at(x)); } + outputFilter(tempProj, xml, xmlFilter, "Root Files"); + xml << import("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); xml << tag("ImportGroup") -- cgit v1.2.3 From d9203fa534f31509e87bb6c6c702c1b7149372e3 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Tue, 22 Nov 2016 13:14:53 +0100 Subject: winrt: Add support for Visual Studio 2017 Tested with RC Task-number: QTBUG-57086 Change-Id: I57ecfd0751538dcba41ebaf028de1bc5b4debbb7 Reviewed-by: Maurice Kalinowski --- qmake/generators/win32/msvc_nmake.cpp | 92 +++++++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 15 deletions(-) (limited to 'qmake/generators/win32') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 5b5eecd373..92043e829f 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -75,25 +75,44 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); QString compiler; QString compilerArch; - if (arch == QLatin1String("arm")) { - compiler = QStringLiteral("x86_arm"); - compilerArch = QStringLiteral("arm"); - } else if (arch == QLatin1String("x64")) { + const QString msvcVer = project->first("MSVC_VER").toQString(); + if (msvcVer.isEmpty()) { + fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n"); + return false; + } + + if (msvcVer == QStringLiteral("15.0")) { const ProStringList hostArch = project->values("QMAKE_TARGET.arch"); if (hostArch.contains("x86_64")) - compiler = QStringLiteral("amd64"); + compiler = QStringLiteral("HostX64/"); else - compiler = QStringLiteral("x86_amd64"); - compilerArch = QStringLiteral("amd64"); + compiler = QStringLiteral("HostX86/"); + if (arch == QLatin1String("arm")) { + compiler += QStringLiteral("arm"); + compilerArch = QStringLiteral("arm"); + } else if (arch == QLatin1String("x64")) { + compiler += QStringLiteral("x64"); + compilerArch = QStringLiteral("amd64"); + } else { + compiler += QStringLiteral("x86"); + compilerArch = QStringLiteral("amd64"); + } } else { - arch = QStringLiteral("x86"); + if (arch == QLatin1String("arm")) { + compiler = QStringLiteral("x86_arm"); + compilerArch = QStringLiteral("arm"); + } else if (arch == QLatin1String("x64")) { + const ProStringList hostArch = project->values("QMAKE_TARGET.arch"); + if (hostArch.contains("x86_64")) + compiler = QStringLiteral("amd64"); + else + compiler = QStringLiteral("x86_amd64"); + compilerArch = QStringLiteral("amd64"); + } else { + arch = QStringLiteral("x86"); + } } - const QString msvcVer = project->first("MSVC_VER").toQString(); - if (msvcVer.isEmpty()) { - fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n"); - return false; - } const QString winsdkVer = project->first("WINSDK_VER").toQString(); if (winsdkVer.isEmpty()) { fprintf(stderr, "Mkspec does not specify WINSDK_VER. Cannot continue.\n"); @@ -107,7 +126,11 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) const bool isPhone = project->isActiveConfig(QStringLiteral("winphone")); #ifdef Q_OS_WIN - QString regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\") + msvcVer + ("\\Setup\\VC\\ProductDir"); + QString regKey; + if (msvcVer == QStringLiteral("15.0")) + regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\SxS\\VS7\\") + msvcVer; + else + regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\") + msvcVer + ("\\Setup\\VC\\ProductDir"); const QString vcInstallDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey, KEY_WOW64_32KEY); if (vcInstallDir.isEmpty()) { fprintf(stderr, "Failed to find the Visual Studio installation directory.\n"); @@ -134,7 +157,46 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) QStringList incDirs; QStringList libDirs; QStringList binDirs; - if (msvcVer == QStringLiteral("14.0")) { + if (msvcVer == QStringLiteral("15.0")) { + const QString toolsInstallDir = qgetenv("VCToolsInstallDir"); + if (toolsInstallDir.isEmpty()) { + fprintf(stderr, "Failed to access tools installation dir.\n"); + return false; + } + + binDirs << toolsInstallDir + QStringLiteral("bin/") + compiler; + if (arch == QStringLiteral("x64")) + binDirs << toolsInstallDir + QStringLiteral("bin/HostX86/X86"); + binDirs << kitDir + QStringLiteral("bin/x86"); + binDirs << vcInstallDir + QStringLiteral("Common7/Tools"); + binDirs << vcInstallDir + QStringLiteral("Common7/ide"); + binDirs << vcInstallDir + QStringLiteral("MSBuild/15.0/bin"); + + incDirs << toolsInstallDir + QStringLiteral("include"); + incDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/include"); + + const QString crtVersion = qgetenv("UCRTVersion"); + if (crtVersion.isEmpty()) { + fprintf(stderr, "Failed to access CRT version.\n"); + return false; + } + const QString crtInclude = kitDir + QStringLiteral("Include/") + crtVersion; + const QString crtLib = kitDir + QStringLiteral("Lib/") + crtVersion; + incDirs << crtInclude + QStringLiteral("/ucrt"); + incDirs << crtInclude + QStringLiteral("/um"); + incDirs << crtInclude + QStringLiteral("/shared"); + incDirs << crtInclude + QStringLiteral("/winrt"); + + incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/") + + crtVersion + QStringLiteral("/Include/WinRT"); + + libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store"); + + libDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/lib/") + arch; + + libDirs << crtLib + QStringLiteral("/ucrt/") + arch; + libDirs << crtLib + QStringLiteral("/um/") + arch; + } else if (msvcVer == QStringLiteral("14.0")) { binDirs << vcInstallDir + QStringLiteral("bin/") + compiler; binDirs << vcInstallDir + QStringLiteral("bin/"); // Maybe remove for x86 again? binDirs << kitDir + QStringLiteral("bin/") + (arch == QStringLiteral("arm") ? QStringLiteral("x86") : arch); -- cgit v1.2.3