summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-08-24 14:06:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-08-24 14:06:58 (GMT)
commitd5d86ecf50ea5fee2ce85c5ebe0695e477024741 (patch)
tree364172cc4c8fcd810b57bdd3ea448d57c5a586cb
parent9135e3707d18b3fc37274acc3fca3b9352309a09 (diff)
parent3fa1b9641dd16ad93c64737fd2eeb131cca70f76 (diff)
downloadCMake-d5d86ecf50ea5fee2ce85c5ebe0695e477024741.zip
CMake-d5d86ecf50ea5fee2ce85c5ebe0695e477024741.tar.gz
CMake-d5d86ecf50ea5fee2ce85c5ebe0695e477024741.tar.bz2
Merge topic 'refactor-progress'
3fa1b964 cmGlobalUnixMakefileGenerator3: Change the progress container key. 55e39276 cmState: Make it possible to order cmState::Snapshot. 04168cbb cmGlobalUnixMakefileGenerator3: Rename member. 2394584c cmGlobalGenerator: Rename progress initializer method. b9eb3cd1 cmGlobalGenerator: Move LG to target map to subclass. f5d2b7a6 cmGlobalGenerator: Remove clearance of map.
-rw-r--r--Source/cmGlobalGenerator.cxx47
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx45
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h5
-rw-r--r--Source/cmLinkedTree.h7
-rw-r--r--Source/cmState.cxx6
-rw-r--r--Source/cmState.h7
7 files changed, 71 insertions, 50 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cda26cd..503c455 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1340,7 +1340,7 @@ void cmGlobalGenerator::Generate()
// Create a map from local generator to the complete set of targets
// it builds by default.
- this->FillLocalGeneratorToTargetMap();
+ this->InitializeProgressMarks();
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
@@ -1610,7 +1610,6 @@ void cmGlobalGenerator::ClearGeneratorMembers()
this->TargetDependencies.clear();
this->TotalTargets.clear();
this->ImportedTargets.clear();
- this->LocalGeneratorToTargetMap.clear();
this->ProjectMap.clear();
this->RuleHashes.clear();
this->DirectoryContentMap.clear();
@@ -2118,50 +2117,6 @@ void cmGlobalGenerator::FillProjectMap()
}
}
-
-// Build a map that contains a the set of targets used by each local
-// generator directory level.
-void cmGlobalGenerator::FillLocalGeneratorToTargetMap()
-{
- this->LocalGeneratorToTargetMap.clear();
- // Loop over all targets in all local generators.
- for(std::vector<cmLocalGenerator*>::const_iterator
- lgi = this->LocalGenerators.begin();
- lgi != this->LocalGenerators.end(); ++lgi)
- {
- cmLocalGenerator* lg = *lgi;
- cmMakefile* mf = lg->GetMakefile();
- cmTargets const& targets = mf->GetTargets();
- for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
- {
- cmTarget const& target = t->second;
-
- cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
-
- // 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())
- {
- // This local generator includes the target.
- std::set<cmGeneratorTarget const*>& targetSet =
- this->LocalGeneratorToTargetMap[clg];
- targetSet.insert(gt);
-
- // Add dependencies of the included target. An excluded
- // target may still be included if it is a dependency of a
- // non-excluded target.
- TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
- for(TargetDependSet::const_iterator ti = tgtdeps.begin();
- ti != tgtdeps.end(); ++ti)
- {
- targetSet.insert(*ti);
- }
- }
- }
- }
-}
-
cmMakefile*
cmGlobalGenerator::FindMakefile(const std::string& start_dir) const
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a13bede..fe710f1 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -398,7 +398,7 @@ protected:
void CheckLocalGenerators();
bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const;
bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const;
- void FillLocalGeneratorToTargetMap();
+ virtual void InitializeProgressMarks() {}
void CreateDefaultGlobalTargets(cmTargets* targets);
cmTarget CreateGlobalTarget(const std::string& name, const char* message,
const cmCustomCommandLines* commandLines,
@@ -413,8 +413,6 @@ protected:
cmMakefile* CurrentMakefile;
// map from project name to vector of local generators in that project
std::map<std::string, std::vector<cmLocalGenerator*> > ProjectMap;
- std::map<cmLocalGenerator*, std::set<cmGeneratorTarget const*> >
- LocalGeneratorToTargetMap;
// Set of named installation components requested by the project.
std::set<std::string> InstallComponents;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 76d059ee..b240924 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -917,6 +917,49 @@ cmGlobalUnixMakefileGenerator3
}
}
+// Build a map that contains a the set of targets used by each local
+// generator directory level.
+void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
+{
+ this->DirectoryTargetsMap.clear();
+ // Loop over all targets in all local generators.
+ for(std::vector<cmLocalGenerator*>::const_iterator
+ lgi = this->LocalGenerators.begin();
+ lgi != this->LocalGenerators.end(); ++lgi)
+ {
+ cmLocalGenerator* lg = *lgi;
+ cmMakefile* mf = lg->GetMakefile();
+ cmTargets const& targets = mf->GetTargets();
+ for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t)
+ {
+ cmTarget const& target = t->second;
+
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
+
+ // 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())
+ {
+ // This local generator includes the target.
+ std::set<cmGeneratorTarget const*>& targetSet =
+ this->DirectoryTargetsMap[clg->GetStateSnapshot()];
+ targetSet.insert(gt);
+
+ // Add dependencies of the included target. An excluded
+ // target may still be included if it is a dependency of a
+ // non-excluded target.
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(gt);
+ for(TargetDependSet::const_iterator ti = tgtdeps.begin();
+ ti != tgtdeps.end(); ++ti)
+ {
+ targetSet.insert(*ti);
+ }
+ }
+ }
+ }
+}
+
//----------------------------------------------------------------------------
size_t
cmGlobalUnixMakefileGenerator3
@@ -949,7 +992,7 @@ cmGlobalUnixMakefileGenerator3
size_t count = 0;
std::set<cmGeneratorTarget const*> emitted;
std::set<cmGeneratorTarget const*> const& targets
- = this->LocalGeneratorToTargetMap[lg];
+ = this->DirectoryTargetsMap[lg->GetStateSnapshot()];
for(std::set<cmGeneratorTarget const*>::const_iterator t = targets.begin();
t != targets.end(); ++t)
{
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index fc53fa8..c738c16 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -206,6 +206,11 @@ protected:
private:
virtual const char* GetBuildIgnoreErrorsFlag() const { return "-i"; }
virtual std::string GetEditCacheCommand() const;
+
+ std::map<cmState::Snapshot,
+ std::set<cmGeneratorTarget const*>,
+ cmState::Snapshot::StrictWeakOrder> DirectoryTargetsMap;
+ virtual void InitializeProgressMarks();
};
#endif
diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h
index 3bcb940..721a246 100644
--- a/Source/cmLinkedTree.h
+++ b/Source/cmLinkedTree.h
@@ -128,6 +128,13 @@ public:
}
return this->Position <= this->Tree->Data.size();
}
+
+ bool StrictWeakOrdered(iterator other) const
+ {
+ assert(this->Tree);
+ assert(this->Tree == other.Tree);
+ return this->Position < other.Position;
+ }
};
iterator Root() const
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 4ad6d3b..84d8783 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -1410,3 +1410,9 @@ void cmState::Directory::ClearCompileOptions()
this->DirectoryState->CompileOptionsBacktraces,
this->Snapshot_.Position->CompileOptionsPosition);
}
+
+bool cmState::Snapshot::StrictWeakOrder::operator()(
+ const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) const
+{
+ return lhs.Position.StrictWeakOrdered(rhs.Position);
+}
diff --git a/Source/cmState.h b/Source/cmState.h
index 07aa2a5..3132d1b 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -74,9 +74,16 @@ public:
Directory GetDirectory() const;
+ struct StrictWeakOrder
+ {
+ bool operator()(const cmState::Snapshot& lhs,
+ const cmState::Snapshot& rhs) const;
+ };
+
private:
friend class cmState;
friend class Directory;
+ friend struct StrictWeakOrder;
cmState* State;
cmState::PositionType Position;
};