[Cmake-commits] CMake branch, next, updated. v3.0.2-5565-gc23378f

Brad King brad.king at kitware.com
Fri Oct 3 08:56:19 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  c23378ff426f2597f35eb27b53bc2a99b5a0f069 (commit)
       via  9f32a2411b35df1d80a65a3e27e9db6faf959c91 (commit)
      from  18e64f0122b0c6e878b4284f185bfda7b81ec790 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c23378ff426f2597f35eb27b53bc2a99b5a0f069
commit c23378ff426f2597f35eb27b53bc2a99b5a0f069
Merge: 18e64f0 9f32a24
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Oct 3 08:56:18 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 3 08:56:18 2014 -0400

    Merge topic 'ninja-console-pool' into next
    
    9f32a241 Ninja: Use 'console' pool for CMake re-run if possible (#14915)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f32a2411b35df1d80a65a3e27e9db6faf959c91
commit 9f32a2411b35df1d80a65a3e27e9db6faf959c91
Author:     Sylvain Joubert <joubert.sy at gmail.com>
AuthorDate: Thu Oct 2 21:21:05 2014 +0200
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Oct 3 08:48:47 2014 -0400

    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.

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,
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 4cbbeea..a192eee 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -297,6 +297,8 @@ public:
   void AddTargetAlias(const std::string& alias, cmTarget* target);
 
   virtual void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const;
+
+  std::string ninjaVersion() const;
 protected:
 
   /// Overloaded methods. @see cmGlobalGenerator::Generate()
@@ -335,7 +337,6 @@ private:
 
   std::string ninjaCmd() const;
 
-
   /// The file containing the build statement. (the relation ship of the
   /// compilation DAG).
   cmGeneratedFileStream* BuildFileStream;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 2ac8363..5522e0d 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -189,6 +189,7 @@ void cmLocalNinjaGenerator::WriteBuildFileTop()
 {
   // For the build file.
   this->WriteProjectHeader(this->GetBuildFileStream());
+  this->WriteNinjaRequiredVersion(this->GetBuildFileStream());
   this->WriteNinjaFilesInclusion(this->GetBuildFileStream());
 
   // For the rule file.
@@ -205,6 +206,30 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
   cmGlobalNinjaGenerator::WriteDivider(os);
 }
 
+void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os)
+{
+  // Default required version
+  // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3
+  std::string requiredVersion = "1.3";
+
+  // Ninja generator uses the 'console' pool if available (>= 1.5)
+  std::string usedVersion = this->GetGlobalNinjaGenerator()->ninjaVersion();
+  if(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
+                                   usedVersion.c_str(),
+                                   "1.5") ==  false)
+    {
+      requiredVersion = "1.5";
+    }
+
+  cmGlobalNinjaGenerator::WriteComment(os,
+                          "Minimal version of Ninja required by this file");
+  os
+    << "ninja_required_version = "
+    << requiredVersion
+    << std::endl << std::endl
+    ;
+}
+
 void cmLocalNinjaGenerator::WritePools(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 11321b8..c787ac6 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -117,6 +117,7 @@ private:
 
   void WriteBuildFileTop();
   void WriteProjectHeader(std::ostream& os);
+  void WriteNinjaRequiredVersion(std::ostream& os);
   void WriteNinjaFilesInclusion(std::ostream& os);
   void WriteProcessedMakefile(std::ostream& os);
   void WritePools(std::ostream& os);

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGlobalNinjaGenerator.cxx |   23 ++++++++++++++++++++++-
 Source/cmGlobalNinjaGenerator.h   |    3 ++-
 Source/cmLocalNinjaGenerator.cxx  |   25 +++++++++++++++++++++++++
 Source/cmLocalNinjaGenerator.h    |    1 +
 4 files changed, 50 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list