I merged a proposal to next which adds support for Ninja's "pool":

  http://martine.github.io/ninja/manual.html#ref_pool

It adds three new properties, POOLS, LINK_POOL, COMPILE_POOL:

  http://www.cmake.org/cmake/help/git-next/manual/cmake-properties.7.html

With a "pool" it is possible to limit the number of concurrent
processes of a specific rule.

For instance if you have a project with multiple targets and
each target needs all your resources while linking (memory,
hard-disk bandwidth), it makes no sens to start multiple link
processes in parallel. To prevent this the pool feature was
introduced in ninja.

In concrete, with this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 25cd576..d257c97 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,8 @@ if(CMAKE_BOOTSTRAP)
   unset(CMAKE_BOOTSTRAP CACHE)
 endif()

+set_property(GLOBAL PROPERTY POOLS "compile=1")
+

 if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index c01245c..d7c68d5 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -393,6 +393,8 @@ target_link_libraries(CMakeLib cmsys
   ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
   ${CMAKE_CURL_LIBRARIES} )

+set_property(TARGET CMakeLib PROPERTY COMPILE_POOL compile)
+


and the current next branch, ninja builds CMakeLib single threaded,
without passing -j1 to ninja.

Current patch adds only the essentials, but maybe there are more
comfortable ways to use pools.


Peter


--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to