diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/makefile.cpp | 61 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 28 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 1 |
3 files changed, 27 insertions, 63 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 0e3e058c7b..f5b833fc39 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -70,11 +70,6 @@ QT_BEGIN_NAMESPACE -// Well, Windows doesn't have this, so here's the macro -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const { int argv0 = -1; @@ -1749,23 +1744,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil QString tmp_out = project->values(ProKey(comp + ".output")).first().toQString(); if(tmp_out.isEmpty()) return false; - QString tmp_cmd; - const ProKey ckey(comp + ".commands"); - if (!project->isEmpty(ckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(ckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - cmdline[argv0] = Option::fixPathToTargetOS(cmdline.at(argv0).toQString(), false); - tmp_cmd = cmdline.join(' '); - } - } - + const QString tmp_cmd = project->values(ProKey(comp + ".commands")).join(' '); if (config.indexOf("combine") != -1) { QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out); if(system(cmd.toLatin1().constData())) @@ -1829,42 +1808,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->first(ProKey(*it + ".output")).toQString(), Option::output_dir, Option::output_dir); - QString tmp_cmd; - const ProKey ckey(*it + ".commands"); - if (!project->isEmpty(ckey)) { - QStringList cmdline = project->values(ckey).toQStringList(); - int argv0 = findExecutable(cmdline); - if(argv0 != -1) { - cmdline[argv0] = escapeFilePath(Option::fixPathToTargetOS(cmdline.at(argv0), false)); - tmp_cmd = cmdline.join(' '); - } - } - QString tmp_dep_cmd; + const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); + const QString tmp_dep_cmd = project->values(ProKey(*it + "depend_command")).join(' '); QString dep_cd_cmd; - const ProKey dckey(*it + ".depend_command"); - if (!project->isEmpty(dckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(dckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - QString arg = cmdline.at(argv0).toQString(); - const QString c = Option::fixPathToLocalOS(arg, true); - if(exists(c)) { - arg = escapeFilePath(Option::fixPathToLocalOS(arg, false)); - } else { - arg = escapeFilePath(arg); - } - QFileInfo cmdFileInfo(arg); - if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) { - cmdline[argv0] = arg; - tmp_dep_cmd = cmdline.join(' '); - } - } + if (!tmp_dep_cmd.isEmpty()) { dep_cd_cmd = QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index b8a564968d..52511b2008 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -514,18 +514,23 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) const QString target = var("DEST_TARGET"); QString manifest = project->first("QMAKE_MANIFEST").toQString(); QString extraLFlags; + const bool linkerSupportsEmbedding = (msvcVersion() >= 1200); if (manifest.isEmpty()) { generateManifest = true; - manifest = escapeFilePath(target + ".embed.manifest"); - extraLFlags = "/MANIFEST /MANIFESTFILE:" + manifest; - project->values("QMAKE_CLEAN") << manifest; + if (linkerSupportsEmbedding) { + extraLFlags = "/MANIFEST:embed"; + } else { + manifest = escapeFilePath(target + ".embed.manifest"); + extraLFlags += "/MANIFEST /MANIFESTFILE:" + manifest; + project->values("QMAKE_CLEAN") << manifest; + } } else { manifest = escapeFilePath(fileFixify(manifest)); } const QString resourceId = (templateName == "app") ? "1" : "2"; const bool incrementalLinking = project->values("QMAKE_LFLAGS").toQStringList().filter(QRegExp("(/|-)INCREMENTAL:NO")).isEmpty(); - if (incrementalLinking) { + if (incrementalLinking && !linkerSupportsEmbedding) { // Link a resource that contains the manifest without modifying the exe/dll after linking. QString manifest_rc = escapeFilePath(target + "_manifest.rc"); @@ -558,8 +563,10 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) // directly embed the manifest in the executable after linking t << "\n\t"; writeLinkCommand(t, extraLFlags); - t << "\n\tmt.exe /nologo /manifest " << manifest - << " /outputresource:$(DESTDIR_TARGET);" << resourceId; + if (!linkerSupportsEmbedding) { + t << "\n\tmt.exe /nologo /manifest " << manifest + << " /outputresource:$(DESTDIR_TARGET);" << resourceId; + } } } else { t << "\n\t"; @@ -590,4 +597,13 @@ void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &ext t << "\n<<"; } +int NmakeMakefileGenerator::msvcVersion() const +{ + const int fallbackVersion = 800; // Visual Studio 2005 + const QString ver = project->first(ProKey("MSVC_VER")).toQString(); + bool ok; + float f = ver.toFloat(&ok); + return ok ? int(f * 100) : fallbackVersion; +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 4d3c69bdd6..8d8f5360e0 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -54,6 +54,7 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator void writeImplicitRulesPart(QTextStream &t); void writeBuildRulesPart(QTextStream &t); void writeLinkCommand(QTextStream &t, const QString &extraFlags = QString(), const QString &extraInlineFileContent = QString()); + int msvcVersion() const; void init(); protected: |