[llvm] r222341 - Use ninja pools to limit the number of concurrent compile/link jobs.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Nov 19 02:30:03 PST 2014


Author: eugenis
Date: Wed Nov 19 04:30:02 2014
New Revision: 222341

URL: http://llvm.org/viewvc/llvm-project?rev=222341&view=rev
Log:
Use ninja pools to limit the number of concurrent compile/link jobs.

This change makes use of the new "job pool" capability in cmake 3.0
with ninja generator to allow limiting the number of concurrent jobs
of a certain type.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/docs/CMake.rst

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=222341&r1=222340&r2=222341&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Wed Nov 19 04:30:02 2014
@@ -24,6 +24,21 @@ endif()
 
 project(LLVM)
 
+# The following only works with the Ninja generator in CMake >= 3.0.
+set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
+  "Define the maximum number of concurrent compilation jobs.")
+if(LLVM_PARALLEL_COMPILE_JOBS)
+  set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LLVM_PARALLEL_COMPILE_JOBS})
+  set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
+endif()
+
+set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING
+  "Define the maximum number of concurrent link jobs.")
+if(LLVM_PARALLEL_LINK_JOBS)
+  set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS})
+  set(CMAKE_JOB_POOL_LINK link_job_pool)
+endif()
+
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}

Modified: llvm/trunk/docs/CMake.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.rst?rev=222341&r1=222340&r2=222341&view=diff
==============================================================================
--- llvm/trunk/docs/CMake.rst (original)
+++ llvm/trunk/docs/CMake.rst Wed Nov 19 04:30:02 2014
@@ -291,6 +291,12 @@ LLVM-specific variables
   are ``Address``, ``Memory``, ``MemoryWithOrigins`` and ``Undefined``.
   Defaults to empty string.
 
+**LLVM_PARALLEL_COMPILE_JOBS**:STRING
+  Define the maximum number of concurrent compilation jobs.
+
+**LLVM_PARALLEL_LINK_JOBS**:STRING
+  Define the maximum number of concurrent link jobs.
+
 **LLVM_BUILD_DOCS**:BOOL
   Enables all enabled documentation targets (i.e. Doxgyen and Sphinx targets) to
   be built as part of the normal build. If the ``install`` target is run then





More information about the llvm-commits mailing list