diff options
author | Sylvain Joubert <joubert.sy@gmail.com> | 2014-10-02 19:21:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-10-03 12:48:47 (GMT) |
commit | 9f32a2411b35df1d80a65a3e27e9db6faf959c91 (patch) | |
tree | 590110a64a55551693e031871f02f89d22dc0ceb /Source/cmGlobalNinjaGenerator.cxx | |
parent | 99d34f46fa394a9daabb7ca959e1540ae3a41ef2 (diff) | |
download | CMake-9f32a2411b35df1d80a65a3e27e9db6faf959c91.zip CMake-9f32a2411b35df1d80a65a3e27e9db6faf959c91.tar.gz CMake-9f32a2411b35df1d80a65a3e27e9db6faf959c91.tar.bz2 |
Ninja: Use 'console' pool for CMake re-run if possible (#14915)
The pre-defined 'console' pool is a non-buffered pool that runs with a
depth of 1. CMake re-run cannot be run concurrently and it will
eventually output something. A non-buffered pool allows to get it as
soon as possible
Also, generate the minimal required version of Ninja in the build file.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 50e1abb..543ecdb 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1128,6 +1128,16 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()), implicitDeps.end()); + cmNinjaVars variables; + // Use 'console' pool to get non buffered output of the CMake re-run call + // Available since Ninja 1.5 + if(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + ninjaVersion().c_str(), + "1.5") == false) + { + variables["pool"] = "console"; + } + this->WriteBuild(os, "Re-run CMake if any of its inputs changed.", "RERUN_CMAKE", @@ -1135,7 +1145,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) /*explicitDeps=*/ cmNinjaDeps(), implicitDeps, /*orderOnlyDeps=*/ cmNinjaDeps(), - /*variables=*/ cmNinjaVars()); + variables); this->WritePhonyBuild(os, "A missing CMake input file is not an error.", @@ -1154,6 +1164,17 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const return "ninja"; } +std::string cmGlobalNinjaGenerator::ninjaVersion() const +{ + std::string version; + std::string command = ninjaCmd() + " --version"; + cmSystemTools::RunSingleCommand(command.c_str(), + &version, 0, 0, + cmSystemTools::OUTPUT_NONE); + + return version; +} + void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { WriteRule(*this->RulesFileStream, |