Create clean makefiles for winrt builds
Change-Id: I33b74b98e04c1a9ca15ae07fad88f88dd4ce0669 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
f4cc344e01
commit
ede5be6ea0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user