add usefull debug option

This commit is contained in:
Geoffray Levasseur committed 2026-11-26 15:02:01 +01:00
1 parent 1f3ddaf22d
commit 89ef74ab34
1 file changed
+16
+16
View File
@@ -74,6 +74,22 @@ foreach(_cevo_dir AIDIR RESOURCEDIR)
endif() endif()
endforeach() endforeach()
option(ENABLE_ASAN "Activer AddressSanitizer" OFF)
if(ENABLE_ASAN)
if(MSVC)
# Sous Windows avec MSVC : /fsanitize=address et symboles /Zi
# Évitez /ZI (Edit and Continue), incompatible avec ASan sous MSVC
add_compile_options(/fsanitize=address /Zi /fno-omit-frame-pointer)
string(REPLACE "/ZI" "/Zi" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/ZI" "/Zi" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
else()
# Sous Linux (GCC / Clang) et MinGW/Clang sous Windows
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -g)
add_link_options(-fsanitize=address)
endif()
endif()
# ai/ is the generic AI-plugin interface: needed by the app (to load AI # ai/ is the generic AI-plugin interface: needed by the app (to load AI
# modules at runtime) and by the bundled stdai plugin (as its base classes). # modules at runtime) and by the bundled stdai plugin (as its base classes).
if(CEVO_WITH_APP OR CEVO_WITH_AI) if(CEVO_WITH_APP OR CEVO_WITH_AI)