aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2018-04-10 15:37:44 +0200
committerMiguel Costa <miguel.costa@qt.io>2018-04-12 07:54:02 +0000
commita78ac3de4dac14f29c3a5268d50077e26800da96 (patch)
tree398079313c9cab63e6dc0f7215a3e0fc6a5f33e6
parent60eafa669ea02f7b2e279d5298b82fb4d252c5c6 (diff)
Optimize the copy of properties from C++ compiler rule
If using the Qt/MSBuild rules, copying the include path and the preprocessor definitions from the C++ compiler rule to the QtMoc rule will only change project level property storage. Previously, when using custom build steps, the property storage of every moc file needed to be modified, which caused Visual Studio to stop responding, up to several minutes for larger projects. Task-number: QTVSADDINBUG-537 Change-Id: Ie6e631d922c562d3cf2eb59b447dc95a7ef1aef9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/qtprojectlib/QtProject.cs24
-rw-r--r--src/qtvstools/DteEventsHandler.cs12
2 files changed, 35 insertions, 1 deletions
diff --git a/src/qtprojectlib/QtProject.cs b/src/qtprojectlib/QtProject.cs
index dab90ce8..6700da9a 100644
--- a/src/qtprojectlib/QtProject.cs
+++ b/src/qtprojectlib/QtProject.cs
@@ -2542,6 +2542,30 @@ namespace QtProjectLib
return null;
}
+ public void RefreshQtMocIncludePath()
+ {
+ foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) {
+ var propsClCompile = config.Rules.Item("CL") as IVCRulePropertyStorage;
+ var propsQtMoc = config.Rules.Item(QtMoc.ItemTypeName) as IVCRulePropertyStorage;
+ if (propsClCompile == null || propsQtMoc == null)
+ continue;
+ propsQtMoc.SetPropertyValue(QtMoc.Property.IncludePath.ToString(),
+ propsClCompile.GetUnevaluatedPropertyValue("AdditionalIncludeDirectories"));
+ }
+ }
+
+ public void RefreshQtMocDefine()
+ {
+ foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) {
+ var propsClCompile = config.Rules.Item("CL") as IVCRulePropertyStorage;
+ var propsQtMoc = config.Rules.Item(QtMoc.ItemTypeName) as IVCRulePropertyStorage;
+ if (propsClCompile == null || propsQtMoc == null)
+ continue;
+ propsQtMoc.SetPropertyValue(QtMoc.Property.Define.ToString(),
+ propsClCompile.GetUnevaluatedPropertyValue("PreprocessorDefinitions"));
+ }
+ }
+
public void RefreshMocSteps()
{
qtMsBuild.BeginSetItemProperties();
diff --git a/src/qtvstools/DteEventsHandler.cs b/src/qtvstools/DteEventsHandler.cs
index 6e4d0c2d..cf85af27 100644
--- a/src/qtvstools/DteEventsHandler.cs
+++ b/src/qtvstools/DteEventsHandler.cs
@@ -598,7 +598,17 @@ namespace QtVsTools
|| dispid == dispId_VCCLCompilerTool_AdditionalIncludeDirectories
|| dispid == dispId_VCCLCompilerTool_PreprocessorDefinitions) {
var qtPrj = QtProject.Create(vcPrj);
- qtPrj.RefreshMocSteps();
+ if (qtPrj.IsQtMsBuildEnabled()
+ && dispid == dispId_VCCLCompilerTool_AdditionalIncludeDirectories) {
+ qtPrj.RefreshQtMocIncludePath();
+
+ } else if (qtPrj.IsQtMsBuildEnabled()
+ && dispid == dispId_VCCLCompilerTool_PreprocessorDefinitions) {
+ qtPrj.RefreshQtMocDefine();
+
+ } else {
+ qtPrj.RefreshMocSteps();
+ }
}
} else {
// A file specific property has changed.