diff --git a/CMakeLists.txt b/CMakeLists.txt index c69098a0b3..041bbf563a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,8 @@ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "Dev" "Sanitize") string(TOUPPER "${CMAKE_BUILD_TYPE}" build_mode) -include(mode.common) include(mode.${build_mode}) +include(mode.common) add_compile_definitions( ${Seastar_DEFINITIONS_${build_mode}} FMT_DEPRECATED_OSTREAM) @@ -23,6 +23,7 @@ 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 "") +set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(Seastar_TESTING ON CACHE BOOL "" FORCE) add_subdirectory(seastar) diff --git a/cmake/mode.DEBUG.cmake b/cmake/mode.DEBUG.cmake index 15683ad47f..cf69dd2f44 100644 --- a/cmake/mode.DEBUG.cmake +++ b/cmake/mode.DEBUG.cmake @@ -1,8 +1,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") # -fasan -Og breaks some coroutines on aarch64, use -O0 instead - set(default_Seastar_OptimizationLevel_DEBUG "g") -else() set(default_Seastar_OptimizationLevel_DEBUG "0") +else() + set(default_Seastar_OptimizationLevel_DEBUG "g") endif() set(Seastar_OptimizationLevel_DEBUG ${default_Seastar_OptimizationLevel_DEBUG} @@ -19,3 +19,5 @@ set(Seastar_DEFINITIONS_DEBUG set(CMAKE_CXX_FLAGS_DEBUG " -O${Seastar_OptimizationLevel_DEBUG} -g -gz") + +set(stack_usage_threshold_in_KB 40) diff --git a/cmake/mode.DEV.cmake b/cmake/mode.DEV.cmake index ec706ae228..ff7825a4d0 100644 --- a/cmake/mode.DEV.cmake +++ b/cmake/mode.DEV.cmake @@ -12,3 +12,5 @@ set(Seastar_DEFINITIONS_DEV DEVEL SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION SCYLLA_ENABLE_ERROR_INJECTION) + +set(stack_usage_threshold_in_KB 21) diff --git a/cmake/mode.RELEASE.cmake b/cmake/mode.RELEASE.cmake index 2ae825e887..aa8a8f29b7 100644 --- a/cmake/mode.RELEASE.cmake +++ b/cmake/mode.RELEASE.cmake @@ -23,3 +23,5 @@ set(Seastar_DEFINITIONS_DEBUG set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "-Wl,--gc-sections") + +set(stack_usage_threshold_in_KB 13) diff --git a/cmake/mode.common.cmake b/cmake/mode.common.cmake index 076cf9f431..ec8c36cec7 100644 --- a/cmake/mode.common.cmake +++ b/cmake/mode.common.cmake @@ -30,3 +30,10 @@ default_target_arch(target_arch) if(target_arch) string(APPEND CMAKE_CXX_FLAGS " -march=${target_arch}") endif() + +math(EXPR _stack_usage_threshold_in_bytes "${stack_usage_threshold_in_KB} * 1024") +set(_stack_usage_threshold_flag "-Wstack-usage=${_stack_usage_threshold_in_bytes}") +check_cxx_compiler_flag(${_stack_usage_threshold_flag} _stack_usage_flag_supported) +if(_stack_usage_flag_supported) + string(APPEND CMAKE_CXX_FLAGS " ${_stack_usage_threshold_flag}") +endif() diff --git a/rust/CMakeLists.txt b/rust/CMakeLists.txt index 0a916c5c4f..21a71f69e8 100644 --- a/rust/CMakeLists.txt +++ b/rust/CMakeLists.txt @@ -40,7 +40,7 @@ function(generate_cxxbridge name) set(outputs ${header} ${source}) set(command ${CXXBRIDGE} ${input} --include ${parsed_args_INCLUDE}) add_custom_command( - DEPENDS ${input} ${include} + DEPENDS ${input} OUTPUT ${outputs} COMMAND ${command} --header --output ${header} COMMAND ${command} --output ${source}) @@ -59,7 +59,7 @@ add_custom_command( COMMAND ${CXXBRIDGE} --header --output ${cxx_header}) generate_cxxbridge(wasmtime_bindings INPUT wasmtime_bindings/src/lib.rs - INCLUDE ${cxx_header} + INCLUDE rust/cxx.h OUTPUT_DIR "${binding_gen_build_dir}" SOURCES wasmtime_bindings_sources) @@ -72,7 +72,7 @@ target_sources(wasmtime_bindings ${cxx_header} ${wasmtime_bindings_sources}) target_include_directories(wasmtime_bindings - INTERFACE + PUBLIC ${scylla_gen_build_dir}) target_link_libraries(wasmtime_bindings INTERFACE Rust::rust_combined) @@ -80,7 +80,7 @@ target_link_libraries(wasmtime_bindings # only for testing generate_cxxbridge(inc INPUT inc/src/lib.rs - INCLUDE ${cxx_header} + INCLUDE rust/cxx.h OUTPUT_DIR "${binding_gen_build_dir}" SOURCES inc_sources) @@ -90,7 +90,7 @@ target_sources(inc ${cxx_header} ${inc_sources}) target_include_directories(inc - INTERFACE + PUBLIC ${scylla_gen_build_dir}) target_link_libraries(inc INTERFACE Rust::rust_combined)