summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-27 14:04:03 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-08-27 14:04:03 (GMT)
commit2985b9c00348c81d3cba9603e50a22da4e54cefa (patch)
treed86610baa59230bf8312fa8162a5458443e5fddb
parentf96b6af18aebc5791047bc6d7b33375ac570c6e9 (diff)
parent7fbc56ac400fe7aaafaa581bca2f2848287ce7fd (diff)
downloadCMake-2985b9c00348c81d3cba9603e50a22da4e54cefa.zip
CMake-2985b9c00348c81d3cba9603e50a22da4e54cefa.tar.gz
CMake-2985b9c00348c81d3cba9603e50a22da4e54cefa.tar.bz2
Merge topic 'refactor-progress'
7fbc56ac cmGlobalUnixMakefileGenerator3: Implement progress in terms of cmState. 65c434e1 cmGlobalUnixMakefileGenerator3: Inline an IsExcluded call. be56feb6 cmGlobalGenerator: Extract new IsExcluded overload. 45f52003 cmGlobalGenerator: Implement IsExcluded in terms of cmState::Snapshot. af9fc277 cmState: Make Snapshot EqualityComparable. 9b44018d cmGlobalGenerator: Convert IsExcluded to loop. 5f05b562 cmGlobalGenerator: Refactor IsExcluded. 95925a60 cmGlobalGenerator: Don't use else after return.
-rw-r--r--Source/cmGlobalGenerator.cxx48
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx17
-rw-r--r--Source/cmState.cxx10
-rw-r--r--Source/cmState.h7
5 files changed, 62 insertions, 22 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 503c455..be7896d 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2041,24 +2041,37 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
}
}
-bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
- cmLocalGenerator* gen) const
+bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp,
+ cmState::Snapshot const& snp_) const
{
- if(!gen || gen == root)
+ cmState::Snapshot snp = snp_;
+ while (snp.IsValid())
{
- // No directory excludes itself.
- return false;
- }
+ if(snp == rootSnp)
+ {
+ // No directory excludes itself.
+ return false;
+ }
- if(gen->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
- {
- // This directory is excluded from its parent.
- return true;
+ if(snp.GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ {
+ // This directory is excluded from its parent.
+ return true;
+ }
+ snp = snp.GetBuildsystemDirectoryParent();
}
+ return false;
+}
+
+bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
+ cmLocalGenerator* gen) const
+{
+ assert(gen);
+
+ cmState::Snapshot rootSnp = root->GetStateSnapshot();
+ cmState::Snapshot snp = gen->GetStateSnapshot();
- // This directory is included in its parent. Check whether the
- // parent is excluded.
- return this->IsExcluded(root, gen->GetParent());
+ return this->IsExcluded(rootSnp, snp);
}
bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
@@ -2070,12 +2083,9 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
// This target is excluded from its directory.
return true;
}
- else
- {
- // This target is included in its directory. Check whether the
- // directory is excluded.
- return this->IsExcluded(root, target->GetLocalGenerator());
- }
+ // This target is included in its directory. Check whether the
+ // directory is excluded.
+ return this->IsExcluded(root, target->GetLocalGenerator());
}
void
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index fe710f1..23501bc 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -396,6 +396,8 @@ protected:
// has been populated.
void FillProjectMap();
void CheckLocalGenerators();
+ bool IsExcluded(cmState::Snapshot const& root,
+ cmState::Snapshot const& snp) const;
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
virtual void InitializeProgressMarks() {}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index b240924..8c8c56e 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -936,14 +936,25 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+ cmLocalGenerator* tlg = gt->GetLocalGenerator();
+
+ if(gt->GetType() == cmTarget::INTERFACE_LIBRARY
+ || gt->Target->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
+ {
+ continue;
+ }
+
+ cmState::Snapshot csnp = lg->GetStateSnapshot();
+ cmState::Snapshot tsnp = tlg->GetStateSnapshot();
+
// Consider the directory containing the target and all its
// parents until something excludes the target.
- for(cmLocalGenerator* clg = lg; clg && !this->IsExcluded(clg, gt);
- clg = clg->GetParent())
+ for( ; csnp.IsValid() && !this->IsExcluded(csnp, tsnp);
+ csnp = csnp.GetBuildsystemDirectoryParent())
{
// This local generator includes the target.
std::set<cmGeneratorTarget const*>& targetSet =
- this->DirectoryTargetsMap[clg->GetStateSnapshot()];
+ this->DirectoryTargetsMap[csnp];
targetSet.insert(gt);
// Add dependencies of the included target. An excluded
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 53fdae0..4e4c2c6 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1701,3 +1701,13 @@ std::vector<std::string> cmState::Directory::GetPropertyKeys() const
}
return keys;
}
+
+bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
+{
+ return lhs.Position == rhs.Position;
+}
+
+bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
+{
+ return lhs.Position != rhs.Position;
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index e503cd2..d683068 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -93,6 +93,10 @@ public:
};
private:
+ friend bool operator==(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs);
+ friend bool operator!=(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs);
friend class cmState;
friend class Directory;
friend struct StrictWeakOrder;
@@ -314,4 +318,7 @@ private:
bool MSYSShell;
};
+bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
+bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs);
+
#endif