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  fcaad8f603e9497116a480ae537d5cea31d84672 (commit)
       via  a9bf9065f576e8e07861505a20ef800bc4ff8c81 (commit)
      from  b5f3f54269327c07f77424ca0b10fbbacc1f0124 (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=fcaad8f603e9497116a480ae537d5cea31d84672
commit fcaad8f603e9497116a480ae537d5cea31d84672
Merge: b5f3f54 a9bf906
Author:     Peter Kuemmel <syntheti...@gmx.net>
AuthorDate: Sat Nov 23 08:57:33 2013 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Sat Nov 23 08:57:33 2013 -0500

    Merge topic 'ninja-compile-link-pool' into next
    
    a9bf906 Ninja: job pool support for compiling and linking


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a9bf9065f576e8e07861505a20ef800bc4ff8c81
commit a9bf9065f576e8e07861505a20ef800bc4ff8c81
Author:     Peter Kümmel <syntheti...@gmx.net>
AuthorDate: Sat Nov 23 10:49:36 2013 +0100
Commit:     Peter Kümmel <syntheti...@gmx.net>
CommitDate: Sat Nov 23 14:52:18 2013 +0100

    Ninja: job pool support for compiling and linking
    
    Could be tested by setting the environment
    variable NINJA_STATUS=[%r]

diff --git a/Help/manual/cmake-properties.7.rst 
b/Help/manual/cmake-properties.7.rst
index abc6fde..c70c08b 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -27,6 +27,7 @@ Properties of Global Scope
    /prop_gbl/IN_TRY_COMPILE
    /prop_gbl/PACKAGES_FOUND
    /prop_gbl/PACKAGES_NOT_FOUND
+   /prop_gbl/JOB_POOLS
    /prop_gbl/PREDEFINED_TARGETS_FOLDER
    /prop_gbl/ECLIPSE_EXTRA_NATURES
    /prop_gbl/REPORT_UNDEFINED_PROPERTIES
@@ -147,6 +148,8 @@ Properties on Targets
    /prop_tgt/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
    /prop_tgt/INTERPROCEDURAL_OPTIMIZATION_CONFIG
    /prop_tgt/INTERPROCEDURAL_OPTIMIZATION
+   /prop_tgt/JOB_POOL_COMPILE
+   /prop_tgt/JOB_POOL_LINK
    /prop_tgt/LABELS
    /prop_tgt/LANG_VISIBILITY_PRESET
    /prop_tgt/LIBRARY_OUTPUT_DIRECTORY_CONFIG
diff --git a/Help/prop_gbl/JOB_POOLS.rst b/Help/prop_gbl/JOB_POOLS.rst
new file mode 100644
index 0000000..25dcb7b
--- /dev/null
+++ b/Help/prop_gbl/JOB_POOLS.rst
@@ -0,0 +1,12 @@
+JOB_POOLS
+---------
+
+Ninja only: List of available pools.
+
+A pool is a named integer property and defines the maximum number
+of concurrent jobs which can be started by a rule assigned to the pool.
+The JOB_POOLS property is a semicolon-separated list of pairs using
+the syntax NAME=integer.
+For instance set_property(GLOBAL PROPERTY POOLS "two_jobs=2;ten_jobs=10").
+Defined pools could be used globally by setting CMAKE_JOB_POOL_COMPILE/LINK
+or per target by setting the target property JOB_POOL_COMPILE/LINK.
diff --git a/Help/prop_tgt/JOB_POOL_COMPILE.rst 
b/Help/prop_tgt/JOB_POOL_COMPILE.rst
new file mode 100644
index 0000000..23d2949
--- /dev/null
+++ b/Help/prop_tgt/JOB_POOL_COMPILE.rst
@@ -0,0 +1,9 @@
+JOB_POOL_COMPILE
+----------------
+
+Ninja only: Pool used for compiling.
+
+The number of parallel compile processes could be limited by defining
+pools with the global JOB_POOLS property and then specifing here the pool name.
+For instance set_target_properties(target PROPERTIES JOB_POOL_COMPILE ten_jobs)
+This property overwrites the variable CMAKE_JOB_POOL_COMPILE.
diff --git a/Help/prop_tgt/JOB_POOL_LINK.rst b/Help/prop_tgt/JOB_POOL_LINK.rst
new file mode 100644
index 0000000..340913e
--- /dev/null
+++ b/Help/prop_tgt/JOB_POOL_LINK.rst
@@ -0,0 +1,9 @@
+JOB_POOL_LINK
+-------------
+
+Ninja only: Pool used for linking.
+
+The number of parallel link processes could be limited by defining
+pools with the global JOB_POOLS property and then specifing here the pool name.
+For instance set_target_properties(target PROPERTIES JOB_POOL_LINK two_jobs)
+This property overwrites the variable CMAKE_JOB_POOL_LINK.
diff --git a/Help/variable/CMAKE_JOB_POOL_COMPILE.rst 
b/Help/variable/CMAKE_JOB_POOL_COMPILE.rst
new file mode 100644
index 0000000..40d9329
--- /dev/null
+++ b/Help/variable/CMAKE_JOB_POOL_COMPILE.rst
@@ -0,0 +1,9 @@
+CMAKE_JOB_POOL_LINK
+-------------------
+
+Job pool used for linking.
+
+If this variable is set to a pool name defined in JOB_POOLS,
+this pool is used for linking without explicitely setting
+the the target property JOB_POOL_LINK.
+Setting JOB_POOL_LINK on a target overwrites CMAKE_JOB_POOL_LINK.
diff --git a/Help/variable/CMAKE_JOB_POOL_LINK.rst 
b/Help/variable/CMAKE_JOB_POOL_LINK.rst
new file mode 100644
index 0000000..d7998f4
--- /dev/null
+++ b/Help/variable/CMAKE_JOB_POOL_LINK.rst
@@ -0,0 +1,9 @@
+CMAKE_JOB_POOL_COMPILE
+----------------------
+
+Job pool used for compiling.
+
+If this variable is set to a pool name defined in JOB_POOLS,
+this pool is used for compling without explicitely setting
+the the target property JOB_POOL_COMPILING.
+Setting JOB_POOL_COMPILING on a target overwrites CMAKE_JOB_POOL_COMPILE.
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 4fd0d5c..27bd220 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -106,6 +106,7 @@ public:
                                const cmNinjaDeps& outputs,
                                const cmNinjaDeps& deps = cmNinjaDeps(),
                                const cmNinjaDeps& orderOnly = cmNinjaDeps());
+
   void WriteMacOSXContentBuild(const std::string& input,
                                const std::string& output);
 
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index f1d5e2c..1caf38b 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -53,6 +53,8 @@ void cmLocalNinjaGenerator::Generate()
     {
     this->WriteBuildFileTop();
 
+    this->WritePools(this->GetRulesFileStream());
+
     const std::string showIncludesPrefix = this->GetMakefile()
              ->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX");
     if (!showIncludesPrefix.empty())
@@ -195,6 +197,32 @@ void 
cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
   cmGlobalNinjaGenerator::WriteDivider(os);
 }
 
+void cmLocalNinjaGenerator::WritePools(std::ostream& os)
+{
+  cmGlobalNinjaGenerator::WriteDivider(os);
+
+  const char* jobpools = this->GetCMakeInstance()
+                               ->GetProperty("JOB_POOLS", cmProperty::GLOBAL);
+  if (jobpools)
+    {
+    cmGlobalNinjaGenerator::WriteComment(os,
+                            "Pools defined by global property JOB_POOLS");
+    std::vector<std::string> pools;
+    cmSystemTools::ExpandListArgument(jobpools, pools);
+    for (size_t i = 0; i < pools.size(); ++i)
+      {
+      const std::string pool = pools[i];
+      std::string::size_type eq = pool.find("=");
+      if (eq != std::string::npos && pool.size() > eq)
+        {
+        os << "pool " << pool.substr(0, eq) << std::endl;
+        os << "  depth = " << pool.substr(eq + 1) << std::endl;
+        os << std::endl;
+        }
+      }
+    }
+}
+
 void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index 8eb63c5..ea854c6 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -112,6 +112,7 @@ private:
   void WriteProjectHeader(std::ostream& os);
   void WriteNinjaFilesInclusion(std::ostream& os);
   void WriteProcessedMakefile(std::ostream& os);
+  void WritePools(std::ostream& os);
 
   void SetConfigName();
 
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 44aaa66..287ecaf 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -190,6 +190,7 @@ public:
     const char* comment, const char* workingDir,
     bool replace = false,
     bool escapeOldStyle = true);
+
   void AddCustomCommandOldStyle(const char* target,
                                 const std::vector<std::string>& outputs,
                                 const std::vector<std::string>& depends,
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index d8e9b34..e65c4b5 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -462,6 +462,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
                                             linkPath,
                                             this->GetGeneratorTarget());
 
+  this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars);
+
   this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
   vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
                         ::EncodeLiteral(vars["LINK_FLAGS"]);
diff --git a/Source/cmNinjaTargetGenerator.cxx 
b/Source/cmNinjaTargetGenerator.cxx
index 26eadbe..2915db0 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -568,10 +568,13 @@ cmNinjaTargetGenerator
   EnsureParentDirectoryExists(objectFileName);
 
   std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName);
+
   vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat(
                          ConvertToNinjaPath(objectDir.c_str()).c_str(),
                          cmLocalGenerator::SHELL);
 
+  this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars);
+
   this->SetMsvcTargetPdbVariable(vars);
 
   if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS"))
@@ -725,3 +728,19 @@ 
cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
   // Add as a dependency of all target so that it gets called.
   this->Generator->GetGlobalGenerator()->AddDependencyToAll(output);
 }
+
+void cmNinjaTargetGenerator::addPoolNinjaVariable(const char* pool_property,
+                                                  cmTarget* target,
+                                                  cmNinjaVars& vars)
+{
+    const char* pool = target->GetProperty(pool_property);
+    if (!pool)
+      {
+      const std::string var = std::string("CMAKE_") + pool_property;
+      pool = this->GetMakefile()->GetDefinition(var.c_str());
+      }
+    if (pool)
+      {
+      vars["pool"] = pool;
+      }
+}
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 1cf811a..cfc95f5 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -136,12 +136,15 @@ protected:
   };
   friend struct MacOSXContentGeneratorType;
 
-protected:
+
   MacOSXContentGeneratorType* MacOSXContentGenerator;
   // Properly initialized by sub-classes.
   cmOSXBundleGenerator* OSXBundleGenerator;
   std::set<cmStdString> MacContentFolders;
 
+  void addPoolNinjaVariable(const char* pool_property,
+                            cmTarget* target,
+                            cmNinjaVars& vars);
 
 private:
   cmTarget* Target;

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

Summary of changes:
 Help/manual/cmake-properties.7.rst       |    3 +++
 Help/prop_gbl/JOB_POOLS.rst              |   12 ++++++++++++
 Help/prop_tgt/JOB_POOL_COMPILE.rst       |    9 +++++++++
 Help/prop_tgt/JOB_POOL_LINK.rst          |    9 +++++++++
 Help/variable/CMAKE_JOB_POOL_COMPILE.rst |    9 +++++++++
 Help/variable/CMAKE_JOB_POOL_LINK.rst    |    9 +++++++++
 Source/cmGlobalNinjaGenerator.h          |    1 +
 Source/cmLocalNinjaGenerator.cxx         |   28 ++++++++++++++++++++++++++++
 Source/cmLocalNinjaGenerator.h           |    1 +
 Source/cmMakefile.h                      |    1 +
 Source/cmNinjaNormalTargetGenerator.cxx  |    2 ++
 Source/cmNinjaTargetGenerator.cxx        |   19 +++++++++++++++++++
 Source/cmNinjaTargetGenerator.h          |    5 ++++-
 13 files changed, 107 insertions(+), 1 deletions(-)
 create mode 100644 Help/prop_gbl/JOB_POOLS.rst
 create mode 100644 Help/prop_tgt/JOB_POOL_COMPILE.rst
 create mode 100644 Help/prop_tgt/JOB_POOL_LINK.rst
 create mode 100644 Help/variable/CMAKE_JOB_POOL_COMPILE.rst
 create mode 100644 Help/variable/CMAKE_JOB_POOL_LINK.rst


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to