From fe0b91879b672486ad9581e3fa577b4b32732ecc Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Nov 2016 17:46:22 +0100 Subject: Fix type of VcprojGenerator::extraCompilerOutputs The values of this hash are strings, not lists of strings. Enforce this by using the proper type instead of just using a comment. Change-Id: Id8a13acdceb8f9f8a9a8eaa04e790b1e6cd5faa7 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_objectmodel.cpp | 6 +++--- qmake/generators/win32/msvc_vcproj.cpp | 2 +- qmake/generators/win32/msvc_vcproj.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index fb9c4f354d..98d60f4f04 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2260,10 +2260,10 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) QString inFile = info.file; // is the extracompiler rule on a file with a built in compiler? - const QStringList &objectMappedFile = Project->extraCompilerOutputs[inFile]; + const QString objectMappedFile = Project->extraCompilerOutputs.value(inFile); bool hasBuiltIn = false; if (!objectMappedFile.isEmpty()) { - hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile.at(0)); + hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); } @@ -2305,7 +2305,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // compiler, too bad.. if (hasBuiltIn) { out = inFile; - inFile = objectMappedFile.at(0); + inFile = objectMappedFile; } // Dependency for the output diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 7b3d7fd160..38e7e96b98 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -889,7 +889,7 @@ void VcprojGenerator::init() QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables( compiler_out, file, QString(), NoShell), false); extraCompilerSources[out] += quc.toQString(); - extraCompilerOutputs[out] = QStringList(file); // Can only have one + extraCompilerOutputs[out] = file; } } } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 9ccd8c2552..39ba2f0900 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -63,7 +63,7 @@ public: static bool hasBuiltinCompiler(const QString &file); QHash extraCompilerSources; - QHash extraCompilerOutputs; + QHash extraCompilerOutputs; bool usePCH; VCProjectWriter *projectWriter; -- cgit v1.2.3 From dcd2f8295179170d6459edcb06ff9bd339748de6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Nov 2016 18:16:35 +0100 Subject: Fix circular dependencies in generated vcxproj files For QMAKE_EXTRA_COMPILERS with inputs that are "buildable" (e.g. C++ sources) the custom build step is added to the output file. From Visual Studio's point of view this looks like a circular dependency (e.g. foo.moc generates foo.moc). Usually this just prints a warning that can be ignored. But this circular dependency also breaks dependencies between custom build steps. This became noticeable when the generation of moc_predefs.h was added. Generating moc_predefs.h must be done before any moc custom build step is executed. This patch fixes the issue by using fake files (output file plus suffix ".cbt" for "custom build tool") that act as dummy inputs for the custom build tools. Task-number: QTBUG-16904 Task-number: QTBUG-57196 Change-Id: I4711e44a0551046d215db151fa0312af8a9177a2 Reviewed-by: Oswald Buddenhagen Reviewed-by: Oliver Wolff --- qmake/generators/win32/msvc_objectmodel.cpp | 4 ++++ qmake/generators/win32/msvc_vcproj.cpp | 7 ++++++- qmake/generators/win32/msvc_vcproj.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'qmake/generators') diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 98d60f4f04..70a722ba23 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -2264,6 +2264,10 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) bool hasBuiltIn = false; if (!objectMappedFile.isEmpty()) { hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); + + // Remove the fake file suffix we've added initially to generate correct command lines. + inFile.chop(Project->customBuildToolFilterFileSuffix.length()); + // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); } diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 38e7e96b98..21bdad1bbf 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -198,7 +198,8 @@ const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = pos VcprojGenerator::VcprojGenerator() : Win32MakefileGenerator(), is64Bit(false), - projectWriter(0) + projectWriter(0), + customBuildToolFilterFileSuffix(QStringLiteral(".cbt")) { } @@ -886,8 +887,12 @@ void VcprojGenerator::init() if (!hasBuiltinCompiler(file)) { extraCompilerSources[file] += quc.toQString(); } else { + // Use a fake file name foo.moc.cbt for the project view. + // This prevents VS from complaining about a circular + // dependency from foo.moc -> foo.moc. QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables( compiler_out, file, QString(), NoShell), false); + out += customBuildToolFilterFileSuffix; extraCompilerSources[out] += quc.toQString(); extraCompilerOutputs[out] = file; } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 39ba2f0900..e3e67d64b9 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -64,6 +64,7 @@ public: QHash extraCompilerSources; QHash extraCompilerOutputs; + const QString customBuildToolFilterFileSuffix; bool usePCH; VCProjectWriter *projectWriter; -- cgit v1.2.3 From 019c932ca9bf7c274fd8a402c2af200b5b0cbc59 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 2 Dec 2016 19:53:47 +0100 Subject: unbreak "aux" template for mingw & msvc, take 3 eliminating everying TARGET-related was a nice try, but in the real world (e.g., qttranslations), extra compilers are activated by PRE_TARGETDEPS, which of course doesn't work when TARGET is entirely gone. so instead, let it act as a phony target. this is consistent with the unix generator. supersedes 0810d48bc in amending af2847260. Task-number: QTBUG-57423 Change-Id: I3d2ecc4ff42b37ffe5f71f5c20d17c06b31f4da2 Reviewed-by: Jake Petroules Reviewed-by: Oliver Wolff --- qmake/generators/win32/mingw_make.cpp | 6 +++--- qmake/generators/win32/msvc_nmake.cpp | 5 ++--- qmake/generators/win32/winmakefile.cpp | 3 +++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'qmake/generators') diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index e3d76cd76e..8d5a9a7d0f 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -308,13 +308,13 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS"); + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if (project->first("TEMPLATE") == "aux") { t << "\n\n"; return; } - t << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); + if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index c3ac097a98..746746b9f6 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -549,13 +549,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS"); + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if (templateName == "aux") { t << "\n\n"; return; } - t << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <first("TEMPLATE").endsWith("aux")) + return; + project->values("QMAKE_ORIG_TARGET") = project->values("TARGET"); if (project->isEmpty("QMAKE_PROJECT_NAME")) project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET"); -- cgit v1.2.3