1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-13 00:56:08 +08:00

Ninja: Remove parameter default for cmNinjaTargetDepends

This commit is contained in:
Kyle Edwards 2020-07-24 11:49:59 -04:00
parent 1138907a58
commit cfe2dc4721
6 changed files with 39 additions and 31 deletions

View File

@ -1189,7 +1189,7 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure(
// finally generate the outputs of the target itself, if applicable
cmNinjaDeps outs;
if (!omit_self) {
this->AppendTargetOutputs(target, outs, config);
this->AppendTargetOutputs(target, outs, config, DependOnTargetArtifact);
}
outputs.insert(outs.begin(), outs.end());
}
@ -1201,7 +1201,7 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
std::string outputPath = this->NinjaOutputPath(alias);
std::string buildAlias = this->BuildAlias(outputPath, config);
cmNinjaDeps outputs;
this->AppendTargetOutputs(target, outputs, config);
this->AppendTargetOutputs(target, outputs, config, DependOnTargetArtifact);
// Mark the target's outputs as ambiguous to ensure that no other target
// uses the output as an alias.
for (std::string const& output : outputs) {
@ -1267,11 +1267,12 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
if (ta.second.Config == "all") {
for (auto const& config : this->CrossConfigs) {
this->AppendTargetOutputs(ta.second.GeneratorTarget,
build.ExplicitDeps, config);
build.ExplicitDeps, config,
DependOnTargetArtifact);
}
} else {
this->AppendTargetOutputs(ta.second.GeneratorTarget, build.ExplicitDeps,
ta.second.Config);
ta.second.Config, DependOnTargetArtifact);
}
this->WriteBuild(this->EnableCrossConfigBuild() &&
(ta.second.Config == "all" ||
@ -1299,7 +1300,8 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
build.Outputs.front() = ta.first;
build.ExplicitDeps.clear();
this->AppendTargetOutputs(ta.second.GeneratorTarget,
build.ExplicitDeps, config);
build.ExplicitDeps, config,
DependOnTargetArtifact);
this->WriteBuild(*this->GetConfigFileStream(config), build);
}
}
@ -1321,7 +1323,8 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
build.ExplicitDeps.clear();
for (auto const& config : this->DefaultConfigs) {
this->AppendTargetOutputs(ta.second.GeneratorTarget,
build.ExplicitDeps, config);
build.ExplicitDeps, config,
DependOnTargetArtifact);
}
this->WriteBuild(*this->GetDefaultFileStream(), build);
}
@ -1358,7 +1361,8 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
configDeps.emplace_back(build.Outputs.front());
for (DirectoryTarget::Target const& t : dt.Targets) {
if (!IsExcludedFromAllInConfig(t, config)) {
this->AppendTargetOutputs(t.GT, build.ExplicitDeps, config);
this->AppendTargetOutputs(t.GT, build.ExplicitDeps, config,
DependOnTargetArtifact);
}
}
for (DirectoryTarget::Dir const& d : dt.Children) {

View File

@ -318,14 +318,13 @@ public:
virtual std::string OrderDependsTargetForTarget(
cmGeneratorTarget const* target, const std::string& config) const;
void AppendTargetOutputs(
cmGeneratorTarget const* target, cmNinjaDeps& outputs,
const std::string& config,
cmNinjaTargetDepends depends = DependOnTargetArtifact);
void AppendTargetDepends(
cmGeneratorTarget const* target, cmNinjaDeps& outputs,
const std::string& config, const std::string& fileConfig,
cmNinjaTargetDepends depends = DependOnTargetArtifact);
void AppendTargetOutputs(cmGeneratorTarget const* target,
cmNinjaDeps& outputs, const std::string& config,
cmNinjaTargetDepends depends);
void AppendTargetDepends(cmGeneratorTarget const* target,
cmNinjaDeps& outputs, const std::string& config,
const std::string& fileConfig,
cmNinjaTargetDepends depends);
void AppendTargetDependsClosure(cmGeneratorTarget const* target,
cmNinjaDeps& outputs,
const std::string& config);

View File

@ -102,9 +102,10 @@ void cmLocalNinjaGenerator::Generate()
this->GetGlobalGenerator()->IsMultiConfig()) {
cmNinjaBuild phonyAlias("phony");
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.Outputs, "");
target.get(), phonyAlias.Outputs, "", DependOnTargetArtifact);
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.ExplicitDeps, config);
target.get(), phonyAlias.ExplicitDeps, config,
DependOnTargetArtifact);
this->GetGlobalNinjaGenerator()->WriteBuild(
*this->GetGlobalNinjaGenerator()->GetConfigFileStream(config),
phonyAlias);
@ -115,11 +116,12 @@ void cmLocalNinjaGenerator::Generate()
if (!this->GetGlobalNinjaGenerator()->GetDefaultConfigs().empty()) {
cmNinjaBuild phonyAlias("phony");
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.Outputs, "");
target.get(), phonyAlias.Outputs, "", DependOnTargetArtifact);
for (auto const& config :
this->GetGlobalNinjaGenerator()->GetDefaultConfigs()) {
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.ExplicitDeps, config);
target.get(), phonyAlias.ExplicitDeps, config,
DependOnTargetArtifact);
}
this->GetGlobalNinjaGenerator()->WriteBuild(
*this->GetGlobalNinjaGenerator()->GetDefaultFileStream(),
@ -127,10 +129,11 @@ void cmLocalNinjaGenerator::Generate()
}
cmNinjaBuild phonyAlias("phony");
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.Outputs, "all");
target.get(), phonyAlias.Outputs, "all", DependOnTargetArtifact);
for (auto const& config : this->GetConfigNames()) {
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
target.get(), phonyAlias.ExplicitDeps, config);
target.get(), phonyAlias.ExplicitDeps, config,
DependOnTargetArtifact);
}
this->GetGlobalNinjaGenerator()->WriteBuild(
*this->GetGlobalNinjaGenerator()->GetDefaultFileStream(),
@ -355,8 +358,8 @@ void cmLocalNinjaGenerator::AppendTargetOutputs(cmGeneratorTarget* target,
cmNinjaDeps& outputs,
const std::string& config)
{
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs,
config);
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(target, outputs, config,
DependOnTargetArtifact);
}
void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target,

View File

@ -66,10 +66,10 @@ public:
void AppendTargetOutputs(cmGeneratorTarget* target, cmNinjaDeps& outputs,
const std::string& config);
void AppendTargetDepends(
cmGeneratorTarget* target, cmNinjaDeps& outputs, const std::string& config,
const std::string& fileConfig,
cmNinjaTargetDepends depends = DependOnTargetArtifact);
void AppendTargetDepends(cmGeneratorTarget* target, cmNinjaDeps& outputs,
const std::string& config,
const std::string& fileConfig,
cmNinjaTargetDepends depends);
void AddCustomCommandTarget(cmCustomCommand const* cc,
cmGeneratorTarget* target);

View File

@ -743,7 +743,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement(
// Gather order-only dependencies.
this->GetLocalGenerator()->AppendTargetDepends(
this->GetGeneratorTarget(), build.OrderOnlyDeps, config, config);
this->GetGeneratorTarget(), build.OrderOnlyDeps, config, config,
DependOnTargetArtifact);
// Write the build statement for this target.
bool usedResponseFile = false;
@ -1168,8 +1169,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
globalGen->IsMultiConfig() ? cmStrCat('.', config) : "", ".rsp"));
// Gather order-only dependencies.
this->GetLocalGenerator()->AppendTargetDepends(gt, linkBuild.OrderOnlyDeps,
config, fileConfig);
this->GetLocalGenerator()->AppendTargetDepends(
gt, linkBuild.OrderOnlyDeps, config, fileConfig, DependOnTargetArtifact);
// Add order-only dependencies on versioning symlinks of shared libs we link.
if (!this->GeneratorTarget->IsDLLPlatform()) {

View File

@ -101,7 +101,8 @@ void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(),
config);
}
lg->AppendTargetDepends(genTarget, deps, config, config);
lg->AppendTargetDepends(genTarget, deps, config, config,
DependOnTargetArtifact);
if (commands.empty()) {
phonyBuild.Comment = "Utility command for " + this->GetTargetName();