summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32/msvc_nmake.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-24 10:33:37 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-01-25 20:06:06 +0100
commit318b58562ae89453fb98e8145cd0440e14ba60b0 (patch)
tree622bc032cf076b4569621032f3a3315d95c3ae88 /qmake/generators/win32/msvc_nmake.cpp
parentc28fde3fdac19fd5a5f614bb7983080031c924b3 (diff)
parent79352528a1726b4551ea4d9285dd2394dd0d43da (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/common/msvc-version.conf mkspecs/common/winrt_winphone/qmake.conf mkspecs/features/mac/default_post.prf mkspecs/features/mac/sdk.prf mkspecs/features/qt.prf mkspecs/features/uikit/default_post.prf mkspecs/features/winrt/default_pre.prf mkspecs/winphone-arm-msvc2013/qmake.conf mkspecs/winphone-x86-msvc2013/qmake.conf mkspecs/winrt-arm-msvc2013/qmake.conf mkspecs/winrt-x64-msvc2013/qmake.conf mkspecs/winrt-x86-msvc2013/qmake.conf qmake/generators/win32/msvc_vcproj.cpp src/gui/kernel/qwindowsysteminterface.cpp src/network/kernel/qhostaddress.cpp src/plugins/platforms/mirclient/qmirclientplugin.cpp src/plugins/platforms/mirclient/qmirclientplugin.h src/widgets/util/qsystemtrayicon.cpp tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp tools/configure/Makefile.mingw tools/configure/Makefile.win32 Done-with: Jake Petroules <jake.petroules@qt.io> Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp')
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp94
1 files changed, 78 insertions, 16 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 380ce60c5b..c19c101d43 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -34,7 +34,7 @@
#include <qdiriterator.h>
#include <qset.h>
-#include <windows/registry_p.h>
+#include <registry_p.h>
#include <time.h>
@@ -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");
@@ -106,7 +125,11 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
}
#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");
@@ -128,7 +151,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);