mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
cmLocalGhsMultiGenerator: Generate targets in dependency order
Use the globally computed target ordering so that we generate all of a target's dependencies before generating the target itself.
This commit is contained in:
@@ -2,10 +2,8 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmLocalGhsMultiGenerator.h"
|
#include "cmLocalGhsMultiGenerator.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
#include <cmext/algorithm>
|
|
||||||
|
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGhsMultiTargetGenerator.h"
|
#include "cmGhsMultiTargetGenerator.h"
|
||||||
@@ -29,34 +27,16 @@ std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
|
|
||||||
cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
|
|
||||||
{
|
|
||||||
if (!target->IsInBuildSystem()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Find this target in the list of remaining targets.
|
|
||||||
auto it = std::find(remaining.begin(), remaining.end(), target);
|
|
||||||
if (it == remaining.end()) {
|
|
||||||
// This target was already handled.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Remove this target from the list of remaining targets because
|
|
||||||
// we are handling it now.
|
|
||||||
*it = nullptr;
|
|
||||||
|
|
||||||
cmGhsMultiTargetGenerator tg(target);
|
|
||||||
tg.Generate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmLocalGhsMultiGenerator::Generate()
|
void cmLocalGhsMultiGenerator::Generate()
|
||||||
{
|
{
|
||||||
std::vector<cmGeneratorTarget*> remaining;
|
for (cmGeneratorTarget* gt :
|
||||||
cm::append(remaining, this->GetGeneratorTargets());
|
this->GlobalGenerator->GetLocalGeneratorTargetsInOrder(this)) {
|
||||||
for (auto& t : remaining) {
|
if (!gt->IsInBuildSystem()) {
|
||||||
if (t) {
|
continue;
|
||||||
this->GenerateTargetsDepthFirst(t, remaining);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmGhsMultiTargetGenerator tg(gt);
|
||||||
|
tg.Generate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
|
|
||||||
@@ -37,8 +36,4 @@ public:
|
|||||||
void ComputeObjectFilenames(
|
void ComputeObjectFilenames(
|
||||||
std::map<cmSourceFile const*, std::string>& mapping,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
cmGeneratorTarget const* gt = nullptr) override;
|
cmGeneratorTarget const* gt = nullptr) override;
|
||||||
|
|
||||||
private:
|
|
||||||
void GenerateTargetsDepthFirst(cmGeneratorTarget* target,
|
|
||||||
std::vector<cmGeneratorTarget*>& remaining);
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user