From cf2effc58cd2aabf9f1e9ac3c5d4ff90ae2737cd Mon Sep 17 00:00:00 2001 From: L4stR1t3s <69721170+L4stR1t3s@users.noreply.github.com> Date: Thu, 22 Jul 2021 01:04:01 +0200 Subject: [PATCH] Ninja compile and link pool CMake settings (#2334) * Ninja compile and link pool CMake settings Signed-off-by: L4stR1t3s <69721170+L4stR1t3s@users.noreply.github.com> * Added CMake cached variables for Ninja compile/link pool settings Signed-off-by: L4stR1t3s <69721170+L4stR1t3s@users.noreply.github.com> --- cmake/Platform/Common/Configurations_common.cmake | 15 +++++++++++++++ cmake/Platform/Linux/Configurations_linux.cmake | 7 ------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cmake/Platform/Common/Configurations_common.cmake b/cmake/Platform/Common/Configurations_common.cmake index 6ec788994c..15f7344958 100644 --- a/cmake/Platform/Common/Configurations_common.cmake +++ b/cmake/Platform/Common/Configurations_common.cmake @@ -47,3 +47,18 @@ ly_append_configurations_options( NDEBUG AZ_BUILD_CONFIGURATION_TYPE="${LY_BUILD_CONFIGURATION_TYPE_RELEASE}" ) + +# Ninja: parallel compile and link pool settings +if(CMAKE_GENERATOR MATCHES "Ninja") + set(LY_PARALLEL_COMPILE_JOBS "" CACHE STRING "Number of compile jobs to use (Defaults to not set)") + set(LY_PARALLEL_LINK_JOBS "" CACHE STRING "Number of link jobs to use (Defaults to not set)") + + if(LY_PARALLEL_COMPILE_JOBS) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LY_PARALLEL_COMPILE_JOBS}) + ly_set(CMAKE_JOB_POOL_COMPILE compile_job_pool) + endif() + if(LY_PARALLEL_LINK_JOBS) + set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LY_PARALLEL_LINK_JOBS}) + ly_set(CMAKE_JOB_POOL_LINK link_job_pool) + endif() +endif() diff --git a/cmake/Platform/Linux/Configurations_linux.cmake b/cmake/Platform/Linux/Configurations_linux.cmake index c4a98a4bec..7da0cf188f 100644 --- a/cmake/Platform/Linux/Configurations_linux.cmake +++ b/cmake/Platform/Linux/Configurations_linux.cmake @@ -29,10 +29,3 @@ endif() ly_set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) ly_set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) ly_set(CMAKE_INSTALL_RPATH "$ORIGIN") - -if(CMAKE_GENERATOR MATCHES "Ninja") - if(LY_PARALLEL_LINK_JOBS) - set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LY_PARALLEL_LINK_JOBS}) - ly_set(CMAKE_JOB_POOL_LINK link_job_pool) - endif() -endif()