diff options
author | Brad King <brad.king@kitware.com> | 2013-11-26 14:52:35 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-11-26 14:52:35 (GMT) |
commit | b80ef72b4d8e76bf5912d6d59a749a2d94bb49b2 (patch) | |
tree | d6bbd427e7381689305401b2c4296a2ed8a0b17d /Source/cmLocalNinjaGenerator.cxx | |
parent | fd2ffb42aa8f8927f2ca3bf0c183957da88da2c0 (diff) | |
parent | 7605e37aabae2678e5696a75e84aced2e84f9037 (diff) | |
download | CMake-b80ef72b4d8e76bf5912d6d59a749a2d94bb49b2.zip CMake-b80ef72b4d8e76bf5912d6d59a749a2d94bb49b2.tar.gz CMake-b80ef72b4d8e76bf5912d6d59a749a2d94bb49b2.tar.bz2 |
Merge topic 'ninja-compile-link-pool'
7605e37 Ninja: job pool support for compiling and linking
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 3d04f70..cd12c9d 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()) @@ -201,6 +203,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); |