Merge topic 'ninja-deterministic-gen'
59ade844
Ninja: Fix non-determinism in generated build statement order (#15968)
This commit is contained in:
commit
53108f8008
|
@ -454,13 +454,24 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
|
||||||
void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
|
void cmLocalNinjaGenerator::AddCustomCommandTarget(cmCustomCommand const* cc,
|
||||||
cmGeneratorTarget* target)
|
cmGeneratorTarget* target)
|
||||||
{
|
{
|
||||||
this->CustomCommandTargets[cc].insert(target);
|
CustomCommandTargetMap::value_type v(cc, std::set<cmGeneratorTarget*>());
|
||||||
|
std::pair<CustomCommandTargetMap::iterator, bool>
|
||||||
|
ins = this->CustomCommandTargets.insert(v);
|
||||||
|
if (ins.second)
|
||||||
|
{
|
||||||
|
this->CustomCommands.push_back(cc);
|
||||||
|
}
|
||||||
|
ins.first->second.insert(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
|
void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
|
||||||
{
|
{
|
||||||
for (CustomCommandTargetMap::iterator i = this->CustomCommandTargets.begin();
|
for (std::vector<cmCustomCommand const*>::iterator vi =
|
||||||
i != this->CustomCommandTargets.end(); ++i) {
|
this->CustomCommands.begin(); vi != this->CustomCommands.end(); ++vi)
|
||||||
|
{
|
||||||
|
CustomCommandTargetMap::iterator i = this->CustomCommandTargets.find(*vi);
|
||||||
|
assert(i != this->CustomCommandTargets.end());
|
||||||
|
|
||||||
// A custom command may appear on multiple targets. However, some build
|
// A custom command may appear on multiple targets. However, some build
|
||||||
// systems exist where the target dependencies on some of the targets are
|
// systems exist where the target dependencies on some of the targets are
|
||||||
// overspecified, leading to a dependency cycle. If we assume all target
|
// overspecified, leading to a dependency cycle. If we assume all target
|
||||||
|
|
|
@ -106,6 +106,7 @@ private:
|
||||||
typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> >
|
typedef std::map<cmCustomCommand const*, std::set<cmGeneratorTarget*> >
|
||||||
CustomCommandTargetMap;
|
CustomCommandTargetMap;
|
||||||
CustomCommandTargetMap CustomCommandTargets;
|
CustomCommandTargetMap CustomCommandTargets;
|
||||||
|
std::vector<cmCustomCommand const*> CustomCommands;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ! cmLocalNinjaGenerator_h
|
#endif // ! cmLocalNinjaGenerator_h
|
||||||
|
|
Loading…
Reference in New Issue