mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 12:36:56 +00:00
scylla uses build modes like "debug" and "release" to differentiate different build modes. while we intend to use the typical build configurations / build types used by CMake like "Debug" and "RelWithDebInfo" for naming CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE. the former is used for naming the build directory and for the preprocess macro named "SCYLLA_BUILD_MODE". `test.py` and scylladb's CI are designed based on the naming of build directory. in which, `test.py` lists the build modes using the dedicated build target named "list_modes", which is added by `configure.py`. so, in this change, to prepare for adding the target, "scylla_build_mode" is defined, so we can reuse it in a following-up change. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
33 lines
1.1 KiB
CMake
33 lines
1.1 KiB
CMake
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
"-ffunction-sections -fdata-sections"
|
|
CACHE
|
|
INTERNAL
|
|
"")
|
|
update_cxx_flags(CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
|
WITH_DEBUG_INFO
|
|
OPTIMIZATION_LEVEL "3")
|
|
|
|
set(scylla_build_mode "release")
|
|
add_compile_definitions(
|
|
$<$<CONFIG:RelWithDebInfo>:SCYLLA_BUILD_MODE=${scylla_build_mode}>)
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
|
|
set(clang_inline_threshold 300)
|
|
else()
|
|
set(clang_inline_threshold 2500)
|
|
endif()
|
|
add_compile_options(
|
|
"$<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:GNU>>:--param;inline-unit-growth=300>"
|
|
"$<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:Clang>>:-mllvm;-inline-threshold=${clang_inline_threshold}>")
|
|
# clang generates 16-byte loads that break store-to-load forwarding
|
|
# gcc also has some trouble: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103554
|
|
check_cxx_compiler_flag("-fno-slp-vectorize" _slp_vectorize_supported)
|
|
if(_slp_vectorize_supported)
|
|
add_compile_options(
|
|
$<$<CONFIG:RelWithDebInfo>:-fno-slp-vectorize>)
|
|
endif()
|
|
|
|
add_link_options($<$<CONFIG:RelWithDebInfo>:LINKER:--gc-sections>)
|
|
|
|
maybe_limit_stack_usage_in_KB(13 RelWithDebInfo)
|