summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorPeter Kümmel <syntheticpp@gmx.net>2013-11-23 09:49:36 (GMT)
committerPeter Kümmel <syntheticpp@gmx.net>2013-11-25 21:23:24 (GMT)
commit7605e37aabae2678e5696a75e84aced2e84f9037 (patch)
treedced8cd0e0baf12da23f2e2221abca2483fba313 /Source/cmLocalNinjaGenerator.cxx
parentda6b86f4f031b189768dc474721145a1b99f71ea (diff)
downloadCMake-7605e37aabae2678e5696a75e84aced2e84f9037.zip
CMake-7605e37aabae2678e5696a75e84aced2e84f9037.tar.gz
CMake-7605e37aabae2678e5696a75e84aced2e84f9037.tar.bz2
Ninja: job pool support for compiling and linking
Could be tested by setting the environment variable NINJA_STATUS=[%r]
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 158d714..5d2fb50 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())
@@ -200,6 +202,39 @@ 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];
+ const std::string::size_type eq = pool.find("=");
+ unsigned int jobs;
+ if (eq != std::string::npos &&
+ sscanf(pool.c_str() + eq, "=%u", &jobs) == 1)
+ {
+ os << "pool " << pool.substr(0, eq) << std::endl;
+ os << " depth = " << jobs << std::endl;
+ os << std::endl;
+ }
+ else
+ {
+ cmSystemTools::Error("Invalid pool defined by property 'JOB_POOLS': ",
+ pool.c_str());
+ }
+ }
+ }
+}
+
void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
{
cmGlobalNinjaGenerator::WriteDivider(os);