diff options
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp')
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 57 |
1 files changed, 40 insertions, 17 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 92b4eb5054..306ae57871 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -71,18 +71,28 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return MakefileGenerator::writeStubMakefile(t); #endif if (!project->isHostBuild()) { + const QString msvcVer = project->first("MSVC_VER").toQString(); + if (msvcVer.isEmpty()) { + fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n"); + return false; + } + + bool winrtBuild = false; + bool crossPlatformDesktopBuild = false; + QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); if (project->isActiveConfig(QStringLiteral("winrt"))) { - QString arch = project->first("VCPROJ_ARCH").toQString().toLower(); + winrtBuild = true; + + // Only add explicit support for arm64 cross-platform desktop builds. + } else if ((arch == QLatin1String("arm64")) && (msvcVer == QStringLiteral("15.0"))) { + crossPlatformDesktopBuild = true; + } + + if (winrtBuild || crossPlatformDesktopBuild) { QString compiler; QString compilerArch; - 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 ProStringList hostArch = project->values("QMAKE_TARGET.arch"); if (msvcVer == QStringLiteral("15.0")) { - const ProStringList hostArch = project->values("QMAKE_TARGET.arch"); if (hostArch.contains("x86_64")) compiler = QStringLiteral("HostX64/"); else @@ -93,6 +103,9 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) } else if (arch == QLatin1String("x64")) { compiler += QStringLiteral("x64"); compilerArch = QStringLiteral("amd64"); + } else if (arch == QLatin1String("arm64")) { + compiler += QStringLiteral("arm64"); + compilerArch = QStringLiteral("arm64"); } else { arch = QStringLiteral("x86"); compiler += QStringLiteral("x86"); @@ -119,7 +132,7 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) return false; } const QString targetVer = project->first("WINTARGET_VER").toQString(); - if (targetVer.isEmpty()) { + if (targetVer.isEmpty() && winrtBuild) { fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n"); return false; } @@ -181,10 +194,19 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) incDirs << crtInclude + QStringLiteral("/shared"); incDirs << crtInclude + QStringLiteral("/winrt"); - incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/") - + crtVersion + QStringLiteral("/Include/WinRT"); + if (winrtBuild) { + // Only use mobile-specific headers and link against store-specific libs for + // winrt builds. + incDirs << kitDir + QStringLiteral("Extension SDKs/WindowsMobile/") + + crtVersion + QStringLiteral("/Include/WinRT"); - libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store"); + libDirs << toolsInstallDir + QStringLiteral("lib/") + arch + QStringLiteral("/store"); + } else { + // Desktop projects may require the atl headers and libs. + incDirs << toolsInstallDir + QStringLiteral("atlmfc/include"); + libDirs << toolsInstallDir + QStringLiteral("atlmfc/lib/") + compilerArch; + libDirs << toolsInstallDir + QStringLiteral("lib/") + arch; + } libDirs << vcInstallDir + QStringLiteral("VC/Auxiliary/VS/lib/") + arch; @@ -383,7 +405,7 @@ void NmakeMakefileGenerator::init() processVars(); - project->values("QMAKE_LIBS") += project->values("RES_FILE"); + project->values("LIBS") += project->values("RES_FILE"); if (!project->values("DEF_FILE").isEmpty()) { QString defFileName = fileFixify(project->first("DEF_FILE").toQString()); @@ -499,7 +521,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) QSet<QString> source_directories; if (useInferenceRules) { source_directories.insert("."); - static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", 0 }; + static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", nullptr }; for (int y = 0; directories[y]; y++) { QString dirTemp = project->first(directories[y]).toQString(); if (dirTemp.endsWith("\\")) @@ -507,7 +529,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) if(!dirTemp.isEmpty()) source_directories.insert(dirTemp); } - static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", 0 }; + static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", nullptr }; for (int x = 0; srcs[x]; x++) { const ProStringList &l = project->values(srcs[x]); for (ProStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) { @@ -584,8 +606,9 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); + << ' ' << depVar("ALL_DEPS") << ' ' << depVar("DEST_TARGET") << "\n\n"; + t << depVar("DEST_TARGET") << ": " + << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if (templateName == "aux") { t << "\n\n"; return; |