diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-30 11:40:09 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-05-30 16:38:19 (GMT) |
commit | e762da6dc98474a71d0e69866ec3800af3117466 (patch) | |
tree | b5015d8460109032c87a6014d978b7443d504757 /Source | |
parent | 0d0cb136fb19d96f857f8d7da918e18038d5b627 (diff) | |
download | CMake-e762da6dc98474a71d0e69866ec3800af3117466.zip CMake-e762da6dc98474a71d0e69866ec3800af3117466.tar.gz CMake-e762da6dc98474a71d0e69866ec3800af3117466.tar.bz2 |
Ninja: Use cmNinjaBuild instead of WritePhonyBuild
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 9b651a4..81cafa3 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -454,7 +454,8 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCustomCommand const* cc, const cmNinjaDeps& orderOnlyDeps) { - if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc)) { + cmGlobalNinjaGenerator* gg = this->GetGlobalNinjaGenerator(); + if (gg->SeenCustomCommand(cc)) { return; } @@ -462,13 +463,12 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( const std::vector<std::string>& outputs = ccg.GetOutputs(); const std::vector<std::string>& byproducts = ccg.GetByproducts(); - cmNinjaDeps ninjaOutputs(outputs.size() + byproducts.size()), ninjaDeps; bool symbolic = false; for (std::string const& output : outputs) { if (cmSourceFile* sf = this->Makefile->GetSource(output)) { - symbolic = sf->GetPropertyAsBool("SYMBOLIC"); - if (symbolic) { + if (sf->GetPropertyAsBool("SYMBOLIC")) { + symbolic = true; break; } } @@ -479,25 +479,29 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( file of each imported target that has an add_dependencies pointing \ at us. How to know which ExternalProject step actually provides it? #endif + cmNinjaDeps ninjaOutputs(outputs.size() + byproducts.size()); std::transform(outputs.begin(), outputs.end(), ninjaOutputs.begin(), - this->GetGlobalNinjaGenerator()->MapToNinjaPath()); + gg->MapToNinjaPath()); std::transform(byproducts.begin(), byproducts.end(), - ninjaOutputs.begin() + outputs.size(), - this->GetGlobalNinjaGenerator()->MapToNinjaPath()); - this->AppendCustomCommandDeps(ccg, ninjaDeps); + ninjaOutputs.begin() + outputs.size(), gg->MapToNinjaPath()); for (std::string const& ninjaOutput : ninjaOutputs) { - this->GetGlobalNinjaGenerator()->SeenCustomCommandOutput(ninjaOutput); + gg->SeenCustomCommandOutput(ninjaOutput); } + cmNinjaDeps ninjaDeps; + this->AppendCustomCommandDeps(ccg, ninjaDeps); + std::vector<std::string> cmdLines; this->AppendCustomCommandLines(ccg, cmdLines); if (cmdLines.empty()) { - this->GetGlobalNinjaGenerator()->WritePhonyBuild( - this->GetBuildFileStream(), - "Phony custom command for " + ninjaOutputs[0], ninjaOutputs, ninjaDeps, - cmNinjaDeps(), orderOnlyDeps, cmNinjaVars()); + cmNinjaBuild build("phony"); + build.Comment = "Phony custom command for " + ninjaOutputs[0]; + build.Outputs = std::move(ninjaOutputs); + build.ExplicitDeps = std::move(ninjaDeps); + build.OrderOnlyDeps = orderOnlyDeps; + gg->WriteBuild(this->GetBuildFileStream(), build); } else { std::string customStep = cmSystemTools::GetFilenameName(ninjaOutputs[0]); // Hash full path to make unique. @@ -505,7 +509,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( cmCryptoHash hash(cmCryptoHash::AlgoSHA256); customStep += hash.HashString(ninjaOutputs[0]).substr(0, 7); - this->GetGlobalNinjaGenerator()->WriteCustomCommandBuild( + gg->WriteCustomCommandBuild( this->BuildCommandLine(cmdLines, customStep), this->ConstructComment(ccg), "Custom command for " + ninjaOutputs[0], cc->GetDepfile(), cc->GetJobPool(), cc->GetUsesTerminal(), |