cmake: add SDL_LEAN_AND_MEAN CMake option

This commit is contained in:
Anonymous Maarten
2026-06-17 09:48:33 +02:00
committed by Sam Lantinga
parent 9228b91da2
commit 2ebb96b881
2 changed files with 14 additions and 9 deletions

View File

@@ -359,7 +359,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool, ctest_args
fpic = None
build_parallel = True
if spec.lean:
job.cppflags.append("-DSDL_LEAN_AND_MEAN=1")
job.cmake_arguments.append("-DSDL_LEAN_AND_MEAN=TRUE")
if win32:
job.cmake_arguments.append("-DSDLTEST_PROCDUMP=ON")
job.minidump = True

View File

@@ -182,6 +182,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC OR USE_TCC)
set(SDL_GCC_ATOMICS_DEFAULT ON)
endif()
set(SDL_LEAN_AND_MEAN_DEFAULT FALSE)
if(NGAGE)
set(SDL_LEAN_AND_MEAN_DEFAULT TRUE)
endif()
# Default option knobs
set(SDL_LIBC_DEFAULT ON)
set(SDL_SYSTEM_ICONV_DEFAULT ON)
@@ -400,6 +405,7 @@ set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
set_option(SDL_CLANG_TIDY "Run clang-tidy static analysis" OFF)
dep_option(SDL_GPU_OPENXR "Build SDL_GPU with OpenXR support" ON "SDL_GPU;NOT RISCOS" OFF)
set_option(SDL_LEAN_AND_MEAN "Build a lean SDL library with reduced graphics functionality" ${SDL_LEAN_AND_MEAN_DEFAULT})
if(EMSCRIPTEN)
option_string(SDL_EMSCRIPTEN_PERSISTENT_PATH "Path to mount Emscripten IDBFS at startup or '' to disable" "")
@@ -641,6 +647,13 @@ if(NOT SDL_FOREGROUNDING_SIGNAL STREQUAL "OFF")
sdl_compile_definitions(PRIVATE "SDL_FOREGROUNDING_SIGNAL=${SDL_FOREGROUNDING_SIGNAL}")
endif()
if(SDL_LEAN_AND_MEAN)
sdl_compile_definitions(
PRIVATE
SDL_LEAN_AND_MEAN
)
endif()
# Compiler option evaluation
if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
if(SDL_GCC_ATOMICS)
@@ -3548,14 +3561,6 @@ elseif(NGAGE)
)
set(HAVE_SDL_TIMERS TRUE)
set_option(SDL_LEAN_AND_MEAN "Enable lean and mean" ON)
if(SDL_LEAN_AND_MEAN)
sdl_compile_definitions(
PRIVATE
SDL_LEAN_AND_MEAN
)
endif()
sdl_link_dependency(ngage
LINK_OPTIONS "SHELL:-s MAIN_COMPAT=0"
PKG_CONFIG_LINK_OPTIONS "-s;MAIN_COMPAT=0"