summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-09-02 10:51:17 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-15 13:25:25 +0200
commitede5be6ea0990123384513e701e29d131e76e29a (patch)
treea03f60c7cee94f6065dc0921335ddee42dd289e1 /qmake
parentf4cc344e01e00e640bce10f03c47b25d19c3e7fc (diff)
Create clean makefiles for winrt builds
Change-Id: I33b74b98e04c1a9ca15ae07fad88f88dd4ce0669 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index f7b85d3621..3185e68ecc 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -42,13 +42,27 @@
#include "msvc_nmake.h"
#include "option.h"
#include "cesdkhandler.h"
+
#include <qregexp.h>
#include <qhash.h>
#include <qdir.h>
+
+#include <windows/registry_p.h>
+
#include <time.h>
QT_BEGIN_NAMESPACE
+static QString nmakePathList(const QStringList &list)
+{
+ QStringList pathList;
+ foreach (const QString &path, list)
+ pathList.append(QDir::cleanPath(path));
+
+ return QDir::toNativeSeparators(pathList.join(QLatin1Char(';')))
+ .replace('#', QStringLiteral("^#")).replace('$', QStringLiteral("$$"));
+}
+
NmakeMakefileGenerator::NmakeMakefileGenerator() : Win32MakefileGenerator(), init_flag(false), usePCH(false)
{
@@ -100,6 +114,85 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return false;
}
}
+#ifdef Q_OS_WIN
+ else if (project->isActiveConfig(QStringLiteral("winrt"))) {
+ QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
+ QString compiler;
+ QString compilerArch;
+ if (arch == QStringLiteral("arm")) {
+ compiler = QStringLiteral("x86_arm");
+ compilerArch = QStringLiteral("arm");
+ } else if (arch == QStringLiteral("x64")) {
+ 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");
+#endif
+ 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");
+ return false;
+ }
+
+ QStringList incDirs;
+ QStringList libDirs;
+ QStringList binDirs;
+ const bool isPhone = project->isActiveConfig(QStringLiteral("winphone"));
+ if (isPhone) {
+ QString sdkDir = vcInstallDir + QStringLiteral("/WPSDK/WP80");
+ if (!QDir(sdkDir).exists()) {
+ fprintf(stderr, "Failed to find the Windows Phone SDK in %s.\n"
+ "Check that it is properly installed.\n",
+ qPrintable(QDir::toNativeSeparators(sdkDir)));
+ return false;
+ }
+ 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")
+ << kitDir + QStringLiteral("/include/mincore")
+ << kitDir + QStringLiteral("/include/minwin");
+ } else {
+ incDirs << vcInstallDir + QStringLiteral("/include");
+ 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;
+ incDirs << kitDir + QStringLiteral("/include/um")
+ << kitDir + QStringLiteral("/include/shared")
+ << kitDir + QStringLiteral("/include/winrt");
+ }
+
+ // Inherit PATH
+ binDirs << QString::fromLocal8Bit(qgetenv("PATH")).split(QLatin1Char(';'));
+
+ t << "\nINCLUDE = " << nmakePathList(incDirs);
+ t << "\nLIB = " << nmakePathList(libDirs);
+ t << "\nPATH = " << nmakePathList(binDirs) << '\n';
+ }
+#endif // Q_OS_WIN
}
writeNmakeParts(t);
return MakefileGenerator::writeMakefile(t);