From f43a2c20d3328b46abed42af379a0970d9404b54 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Tue, 4 Aug 2015 08:18:01 +0200 Subject: [PATCH] WinRT: Fix build for Windows 10 The SDK Version has been updated, hence include and lib directories were wrong. Luckily, Microsoft introduced an environment variable in the final VS2015 release to identify the location. Also has the benefit to reduce hardcoded paths. Change-Id: I9726db031d87d119bc7326154b24554c4b685d57 Reviewed-by: Andrew Knight Reviewed-by: Mika Lindqvist --- qmake/generators/win32/msvc_nmake.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index aff8d9fcad0..7646198da1f 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -190,19 +190,24 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) incDirs << vcInstallDir + QStringLiteral("include"); incDirs << vcInstallDir + QStringLiteral("atlmfc/include"); - // ### Investigate why VS uses 10056 first - incDirs << kitDir + QStringLiteral("Include/10.0.10056.0/ucrt"); - incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/ucrt"); - incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/um"); - incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/shared"); - incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/winrt"); + + 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"); libDirs << vcInstallDir + QStringLiteral("lib/store/") + compilerArch; libDirs << vcInstallDir + QStringLiteral("atlmfc/lib") + compilerArch; - // ### Investigate why VS uses 10056 first - libDirs << kitDir + QStringLiteral("lib/10.0.10056.0/ucrt/") + arch; - libDirs << kitDir + QStringLiteral("lib/10.0.10069.0/ucrt/") + arch; - libDirs << kitDir + QStringLiteral("lib/10.0.10069.0/um/") + arch; + + libDirs << crtLib + QStringLiteral("/ucrt/") + arch; + libDirs << crtLib + QStringLiteral("/um/") + arch; } else if (isPhone) { QString sdkDir = vcInstallDir; if (!QDir(sdkDir).exists()) {