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.
This commit is contained in:
commit
d5d86ecf50
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user