diff options
author | Peter Kümmel <syntheticpp@gmx.net> | 2013-11-23 10:49:36 +0100 |
---|---|---|
committer | Peter Kümmel <syntheticpp@gmx.net> | 2013-11-25 22:23:24 +0100 |
commit | 7605e37aabae2678e5696a75e84aced2e84f9037 (patch) | |
tree | dced8cd0e0baf12da23f2e2221abca2483fba313 /Source/cmLocalNinjaGenerator.cxx | |
parent | da6b86f4f031b189768dc474721145a1b99f71ea (diff) | |
download | cmake-7605e37aabae2678e5696a75e84aced2e84f9037.tar.gz |
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.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 158d714c41..5d2fb50cf6 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); |