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

View File

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

View File

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

View File

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

View File

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

View File

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