diff options
author | Andrew Knight <andrew.knight@digia.com> | 2013-10-24 20:14:10 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-25 09:00:37 +0200 |
commit | 07ee43142bca89958567af55d843e8920c644d35 (patch) | |
tree | 140cdb9eed4b238e04c4d5695e4506e11f29b2c2 /qmake | |
parent | c241e4aa49216b3f11c483b28b363be0b095e8dd (diff) |
qmake: Support MSVC2013 for WinRT builds
Change-Id: I1c102f0b029616997d72933a90c0f9a2a3a9e222
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 3185e68ecc..4412a131ad 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -126,24 +126,56 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) compiler = QStringLiteral("x86_amd64"); compilerArch = QStringLiteral("amd64"); } -#ifdef Q_OS_WIN64 - const QString regKey = QStringLiteral("Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"); -#else - const QString regKey = QStringLiteral("Software\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"); + + 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"); + return false; + } + const QString targetVer = project->first("WINTARGET_VER").toQString(); + if (targetVer.isEmpty()) { + fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n"); + return false; + } + + QString regKeyPrefix; +#if !defined(Q_OS_WIN64) && _WIN32_WINNT >= 0x0501 + BOOL isWow64; + IsWow64Process(GetCurrentProcess(), &isWow64); + if (!isWow64) + regKeyPrefix = QStringLiteral("Software\\"); + else #endif + regKeyPrefix = QStringLiteral("Software\\Wow6432Node\\"); + + QString regKey = regKeyPrefix + QStringLiteral("Microsoft\\VisualStudio\\") + msvcVer + ("\\Setup\\VC\\ProductDir"); const QString vcInstallDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey); if (vcInstallDir.isEmpty()) { - fprintf(stderr, "Failed to find the Visual Studio 2012 installation directory.\n" - "Is it installed?.\n"); + fprintf(stderr, "Failed to find the Visual Studio installation directory.\n"); + return false; + } + + const bool isPhone = project->isActiveConfig(QStringLiteral("winphone")); + regKey = regKeyPrefix + + (isPhone ? QStringLiteral("Microsoft\\Microsoft SDKs\\WindowsPhone\\v") + : QStringLiteral("Microsoft\\Microsoft SDKs\\Windows\\v")) + + winsdkVer + QStringLiteral("\\InstallationFolder"); + const QString kitDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey); + if (kitDir.isEmpty()) { + fprintf(stderr, "Failed to find the Windows Kit installation directory.\n"); return false; } QStringList incDirs; QStringList libDirs; QStringList binDirs; - const bool isPhone = project->isActiveConfig(QStringLiteral("winphone")); if (isPhone) { - QString sdkDir = vcInstallDir + QStringLiteral("/WPSDK/WP80"); + QString sdkDir = vcInstallDir + QStringLiteral("/WPSDK/") + targetVer; if (!QDir(sdkDir).exists()) { fprintf(stderr, "Failed to find the Windows Phone SDK in %s.\n" "Check that it is properly installed.\n", @@ -153,14 +185,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) incDirs << sdkDir + QStringLiteral("/include"); libDirs << sdkDir + QStringLiteral("/lib/") + compilerArch; binDirs << sdkDir + QStringLiteral("/bin/") + compiler; - - QString kitDir = vcInstallDir + QStringLiteral("/../../Windows Phone Kits/8.0"); - if (!QDir(kitDir).exists()) { - fprintf(stderr, "Failed to find the Windows Phone Kit in %s.\n" - "Check that it is properly installed.\n", - qPrintable(QDir::toNativeSeparators(kitDir))); - return false; - } libDirs << kitDir + QStringLiteral("/lib/") + arch; incDirs << kitDir + QStringLiteral("/include") << kitDir + QStringLiteral("/include/abi") @@ -171,15 +195,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) libDirs << vcInstallDir + QStringLiteral("/lib/") + compilerArch; binDirs << vcInstallDir + QStringLiteral("/bin/") + compiler << vcInstallDir + QStringLiteral("/../Common7/IDE"); - - QString kitDir = vcInstallDir + QStringLiteral("/../../Windows Kits/8.0"); - if (!QDir(kitDir).exists()) { - fprintf(stderr, "Failed to find the Windows Kit in %s.\n" - "Check that it is properly installed.\n", - qPrintable(QDir::toNativeSeparators(kitDir))); - return false; - } - libDirs << kitDir + QStringLiteral("/Lib/win8/um/") + arch; + libDirs << kitDir + QStringLiteral("/Lib/") + targetVer + ("/um/") + arch; incDirs << kitDir + QStringLiteral("/include/um") << kitDir + QStringLiteral("/include/shared") << kitDir + QStringLiteral("/include/winrt"); |