summaryrefslogtreecommitdiff
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorPeter Kümmel <syntheticpp@gmx.net>2013-11-23 10:49:36 +0100
committerPeter Kümmel <syntheticpp@gmx.net>2013-11-25 22:23:24 +0100
commit7605e37aabae2678e5696a75e84aced2e84f9037 (patch)
treedced8cd0e0baf12da23f2e2221abca2483fba313 /Source/cmLocalNinjaGenerator.cxx
parentda6b86f4f031b189768dc474721145a1b99f71ea (diff)
downloadcmake-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.cxx35
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);