monero-0.17.1.3-linkjobs.patch (1541B)
1 From 12a78e5e745556c29e45b7716a8b038ecfbff800 Mon Sep 17 00:00:00 2001 2 From: Matt Smith <matt@offtopica.uk> 3 Date: Wed, 5 Aug 2020 18:39:44 +0100 4 Subject: [PATCH] cmake: Use job pool feature to limit concurrent jobs 5 6 Add two new options, MONERO_PARALLEL_COMPILE_JOBS and 7 MONERO_PARALLEL_LINK_JOBS to try and prevent running out of memory when 8 building everything. 9 10 Requires >= cmake 3.0.0, and the use of the Ninja generator. 11 12 Useful links: 13 14 * https://cmake.org/cmake/help/latest/prop_gbl/JOB_POOLS.html 15 * https://reviews.llvm.org/D6304 16 --- 17 CMakeLists.txt | 14 ++++++++++++++ 18 1 file changed, 14 insertions(+) 19 20 diff --git a/CMakeLists.txt b/CMakeLists.txt 21 index f63c07a35d..3729a6b659 100644 22 --- a/CMakeLists.txt 23 +++ b/CMakeLists.txt 24 @@ -55,6 +55,20 @@ else() 25 message(STATUS "ccache deselected") 26 endif() 27 28 +if (${CMAKE_VERSION} VERSION_GREATER "3.0.0" AND CMAKE_MAKE_PROGRAM MATCHES "ninja") 29 + set(MONERO_PARALLEL_COMPILE_JOBS "" CACHE STRING "The maximum number of concurrent compilation jobs.") 30 + if (MONERO_PARALLEL_COMPILE_JOBS) 31 + set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${MONERO_PARALLEL_COMPILE_JOBS}) 32 + set(CMAKE_JOB_POOL_COMPILE compile_job_pool) 33 + endif () 34 + 35 + set(MONERO_PARALLEL_LINK_JOBS "" CACHE STRING "The maximum number of concurrent link jobs.") 36 + if (MONERO_PARALLEL_LINK_JOBS) 37 + set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${MONERO_PARALLEL_LINK_JOBS}) 38 + set(CMAKE_JOB_POOL_LINK link_job_pool) 39 + endif () 40 +endif() 41 + 42 enable_language(C ASM) 43 44 function (die msg)