From f90c1860580bcbe6b898ceb86cdd746532470c64 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 12 Feb 2015 10:54:56 +0100 Subject: [PATCH] fix vcxproj generation for CONFIG-=flat, part II Commit 8ee2e497 introduced a regression for CONFIG-=flat vcxproj files. Files with custom build steps (e.g. foo.h with Q_OBJECT) were written into top-level filters ("Header Files" instead of "Header Files\my\sub\dir"). The assumption that the parameter filtername always equals VCFilter::name was wrong. Change-Id: Id5178550310d06b73e42f18597a27012ddd89bb7 Task-number: QTBUG-44413 Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msbuild_objectmodel.cpp | 12 +++++++----- qmake/generators/win32/msbuild_objectmodel.h | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 1e70fcc850..2f98eae075 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -1898,8 +1898,10 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml OutputFilterData *d = &data[i]; if (!d->filter.Config) // only if the filter is not empty continue; - if (outputFileConfig(d, xml, xmlFilter, info.file, fileAdded, hasCustomBuildStep)) + if (outputFileConfig(d, xml, xmlFilter, info.file, filtername, fileAdded, + hasCustomBuildStep)) { fileAdded = true; + } } if ( !fileAdded ) @@ -1910,8 +1912,8 @@ void VCXProjectWriter::outputFileConfigs(VCProject &project, XmlOutput &xml, Xml } bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, - const QString &filename, bool fileAdded, - bool hasCustomBuildStep) + const QString &filename, const QString &fullFilterName, + bool fileAdded, bool hasCustomBuildStep) { VCFilter &filter = d->filter; if (d->inBuild) { @@ -1934,7 +1936,7 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml xmlFilter << tag("CustomBuild") << attrTag("Include",Option::fixPathToLocalOS(filename)) - << attrTagS("Filter", filter.Name); + << attrTagS("Filter", fullFilterName); xml << tag("CustomBuild") << attrTag("Include",Option::fixPathToLocalOS(filename)); @@ -1952,7 +1954,7 @@ bool VCXProjectWriter::outputFileConfig(OutputFilterData *d, XmlOutput &xml, Xml if (!fileAdded) { fileAdded = true; - outputFileConfig(xml, xmlFilter, filename, filter.Name); + outputFileConfig(xml, xmlFilter, filename, fullFilterName); } const QString condition = generateCondition(*filter.Config); diff --git a/qmake/generators/win32/msbuild_objectmodel.h b/qmake/generators/win32/msbuild_objectmodel.h index 18472b049a..68ba0eea83 100644 --- a/qmake/generators/win32/msbuild_objectmodel.h +++ b/qmake/generators/win32/msbuild_objectmodel.h @@ -185,7 +185,9 @@ private: static void outputFilter(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filtername); static void outputFileConfigs(VCProject &project, XmlOutput &xml, XmlOutput &xmlFilter, const VCFilterFile &info, const QString &filtername); - static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, const QString &filename, bool fileAdded, bool hasCustomBuildStep); + static bool outputFileConfig(OutputFilterData *d, XmlOutput &xml, XmlOutput &xmlFilter, + const QString &filename, const QString &fullFilterName, + bool fileAdded, bool hasCustomBuildStep); static void outputFileConfig(XmlOutput &xml, XmlOutput &xmlFilter, const QString &fileName, const QString &filterName); static QString generateCondition(const VCConfiguration &config);