From 2b23de31cafe08a81bfbdf314979f7c1d3c8fbb2 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 7 Mar 2023 12:43:50 +0800 Subject: [PATCH 1/3] build: cmake: use different names for output of check_cxx_compiler_flag * use the value of disabled_warnings, not the variable name for warning options, otherwise we'd checking options like `-Wno-disabled_warnings`. * use different names for the output of check_cxx_compiler_flag() calls. as the output variable of check_cxx_compiler_flag(..) call is cached, we cannot reuse it for checking different warning options, Signed-off-by: Kefu Chai --- cmake/mode.common.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/mode.common.cmake b/cmake/mode.common.cmake index 2a9c382c56..b36770dc24 100644 --- a/cmake/mode.common.cmake +++ b/cmake/mode.common.cmake @@ -6,9 +6,9 @@ set(disabled_warnings parentheses-equality unsupported-friend) include(CheckCXXCompilerFlag) -foreach(warning disabled_warnings) - check_cxx_compiler_flag("-Wno-${warning}" _warning_supported) - if(_warning_supported) +foreach(warning ${disabled_warnings}) + check_cxx_compiler_flag("-Wno-${warning}" _warning_supported_${warning}) + if(_warning_supported_${warning}) list(APPEND _supported_warnings ${warning}) endif() endforeach() From 5e388450572bb0cf36e5c1827b34860c63e57410 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 7 Mar 2023 12:54:27 +0800 Subject: [PATCH 2/3] build: cmake: only add supported warning flags to CMAKE_CXX_FLAGS Signed-off-by: Kefu Chai --- cmake/mode.common.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/mode.common.cmake b/cmake/mode.common.cmake index b36770dc24..076cf9f431 100644 --- a/cmake/mode.common.cmake +++ b/cmake/mode.common.cmake @@ -12,8 +12,8 @@ foreach(warning ${disabled_warnings}) list(APPEND _supported_warnings ${warning}) endif() endforeach() -list(TRANSFORM disabled_warnings PREPEND "-Wno-") -string(JOIN " " CMAKE_CXX_FLAGS "-Wall" "-Werror" ${disabled_warnings}) +list(TRANSFORM _supported_warnings PREPEND "-Wno-") +string(JOIN " " CMAKE_CXX_FLAGS "-Wall" "-Werror" ${_supported_warnings}) function(default_target_arch arch) set(x86_instruction_sets i386 i686 x86_64) From b25a6d5a9c2db9a2572a8889aee6fd371a1372da Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 7 Mar 2023 15:22:54 +0800 Subject: [PATCH 3/3] build: cmake: limit the number of link job this mirrors the settings in `configure.py`. Signed-off-by: Kefu Chai --- CMakeLists.txt | 1 + cmake/limit_jobs.cmake | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 cmake/limit_jobs.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf83cb857..9acbf6dab6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ include("mode.${build_mode}") add_compile_definitions( ${Seastar_DEFINITIONS_${build_mode}} FMT_DEPRECATED_OSTREAM) +include("limit_jobs") # Configure Seastar compile options to align with Scylla set(CMAKE_CXX_STANDARD "20" CACHE INTERNAL "") set(CMAKE_CXX_EXTENSIONS ON CACHE INTERNAL "") diff --git a/cmake/limit_jobs.cmake b/cmake/limit_jobs.cmake new file mode 100644 index 0000000000..0923d72519 --- /dev/null +++ b/cmake/limit_jobs.cmake @@ -0,0 +1,16 @@ +set(Seastar_LINK_MEM_PER_JOB 1024 CACHE INTERNAL "Maximum memory used by each link job in (in MiB)") + +cmake_host_system_information( + RESULT _total_mem + QUERY AVAILABLE_PHYSICAL_MEMORY) +math(EXPR _link_pool_depth "${_total_mem} / ${Seastar_LINK_MEM_PER_JOB}") +if(_link_pool_depth EQUAL 0) + set(_link_pool_depth 1) +endif() +set_property( + GLOBAL + APPEND + PROPERTY JOB_POOLS + link_pool=${_link_pool_depth} + submodule_pool=1) +set(CMAKE_JOB_POOL_LINK link_pool)