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>
This commit is contained in:
Andrew Knight 2013-10-24 20:14:10 +03:00 committed by The Qt Project
parent c241e4aa49
commit 07ee43142b
9 changed files with 65 additions and 25 deletions

View File

@ -14,3 +14,6 @@ QMAKE_LFLAGS += /MACHINE:ARM
QMAKE_LIBS += WindowsPhoneCore.lib PhoneAppModelHost.lib ws2_32.lib
VCPROJ_ARCH = ARM
MSVC_VER = 11.0
WINSDK_VER = 8.0
WINTARGET_VER = WP80

View File

@ -14,3 +14,6 @@ QMAKE_LFLAGS += /MACHINE:X86
QMAKE_LIBS += WindowsPhoneCore.lib PhoneAppModelHost.lib ws2_32.lib
VCPROJ_ARCH = x86
MSVC_VER = 11.0
WINSDK_VER = 8.0
WINTARGET_VER = WP80

View File

@ -13,3 +13,6 @@ QMAKE_LFLAGS += /MACHINE:ARM
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = ARM
MSVC_VER = 11.0
WINSDK_VER = 8.0
WINTARGET_VER = win8

View File

@ -15,3 +15,6 @@ QMAKE_LFLAGS += /MACHINE:ARM
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = ARM
MSVC_VER = 12.0
WINSDK_VER = 8.1
WINTARGET_VER = winv6.3

View File

@ -13,3 +13,6 @@ QMAKE_LFLAGS += /MACHINE:X64
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = x64
MSVC_VER = 11.0
WINSDK_VER = 8.0
WINTARGET_VER = win8

View File

@ -15,3 +15,6 @@ QMAKE_LFLAGS += /MACHINE:X64
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = x64
MSVC_VER = 12.0
WINSDK_VER = 8.1
WINTARGET_VER = winv6.3

View File

@ -13,3 +13,6 @@ QMAKE_LFLAGS += /MACHINE:X86
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = x86
MSVC_VER = 11.0
WINSDK_VER = 8.0
WINTARGET_VER = win8

View File

@ -15,3 +15,6 @@ QMAKE_LFLAGS += /MACHINE:X86
QMAKE_LIBS += windowscodecs.lib kernel32.lib ole32.lib
VCPROJ_ARCH = x86
MSVC_VER = 12.0
WINSDK_VER = 8.1
WINTARGET_VER = winv6.3

View File

@ -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");