From 3c1cb24fe4c0cde0cfe4b18f13fea4966ace8a41 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 21 Apr 2015 15:43:29 +0200 Subject: fix extra compilers with indirect outputs in VS projects Evaluate the .output variable of the extra compiler to determine the file extension of its output. The VS project generator needs it to determine the filter that will contain the output file. Change-Id: Iab1e154a712342401e17421c08975fad13967a5b Task-number: QTBUG-45717 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msvc_vcproj.cpp | 21 +++++++++++++++++++-- qmake/generators/win32/msvc_vcproj.h | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 0d78766606..1fa117afda 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -421,6 +421,24 @@ bool VcprojGenerator::isStandardSuffix(const QString &suffix) const return false; } +ProString VcprojGenerator::firstInputFileName(const ProString &extraCompilerName) const +{ + foreach (const ProString &var, project->values(ProKey(extraCompilerName + ".input"))) { + const ProStringList &files = project->values(var.toKey()); + if (!files.isEmpty()) + return files.first(); + } + return ProString(); +} + +QString VcprojGenerator::firstExpandedOutputFileName(const ProString &extraCompilerName) +{ + const ProString firstOutput = project->first(ProKey(extraCompilerName + ".output")); + return replaceExtraCompilerVariables(firstOutput.toQString(), + firstInputFileName(extraCompilerName).toQString(), + QString(), NoShell); +} + ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash &projLookup, QHash &projGuids, QHash &extraSubdirs, @@ -1642,10 +1660,9 @@ void VcprojGenerator::initExtraCompilerOutputs() extraCompile.Filter = ""; extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it); - // If the extra compiler has a variable_out set the output file // is added to an other file list, and does not need its own.. - bool addOnInput = hasBuiltinCompiler(project->first(ProKey(*it + ".output")).toQString()); + bool addOnInput = hasBuiltinCompiler(firstExpandedOutputFileName(*it)); const ProString &tmp_other_out = project->first(ProKey(*it + ".variable_out")); if (!tmp_other_out.isEmpty() && !addOnInput) continue; diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 3396ea4986..3f99e02e92 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -135,6 +135,8 @@ private: QUuid increaseUUID(const QUuid &id); QString retrievePlatformToolSet() const; bool isStandardSuffix(const QString &suffix) const; + ProString firstInputFileName(const ProString &extraCompilerName) const; + QString firstExpandedOutputFileName(const ProString &extraCompilerName); friend class VCFilter; }; -- cgit v1.2.3