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) diff --git a/cmake/mode.common.cmake b/cmake/mode.common.cmake index 2a9c382c56..076cf9f431 100644 --- a/cmake/mode.common.cmake +++ b/cmake/mode.common.cmake @@ -6,14 +6,14 @@ 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() -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)