Enable standard library assertions in CI

This commit is contained in:
vittorioromeo 2024-06-23 03:30:42 +02:00 committed by Vittorio Romeo
parent dfd14dbc1b
commit db245a440f
3 changed files with 9 additions and 1 deletions

View File

@ -63,7 +63,7 @@ jobs:
- platform: { name: Windows MinGW, os: windows-2022 } - platform: { name: Windows MinGW, os: windows-2022 }
config: { name: Static Standard Libraries, flags: -GNinja -DSFML_USE_MESA3D=TRUE -DCMAKE_CXX_COMPILER=g++ -DSFML_USE_STATIC_STD_LIBS=TRUE } config: { name: Static Standard Libraries, flags: -GNinja -DSFML_USE_MESA3D=TRUE -DCMAKE_CXX_COMPILER=g++ -DSFML_USE_STATIC_STD_LIBS=TRUE }
- platform: { name: Windows MinGW, os: windows-2022 } - platform: { name: Windows MinGW, os: windows-2022 }
config: { name: Static with PCH (GCC), flags: -GNinja -DSFML_USE_MESA3D=TRUE -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=FALSE -DSFML_ENABLE_PCH=1 } config: { name: Static with PCH (GCC), flags: -GNinja -DSFML_USE_MESA3D=TRUE -DCMAKE_CXX_COMPILER=g++ -DBUILD_SHARED_LIBS=FALSE -DSFML_ENABLE_PCH=1 -DSFML_ENABLE_STDLIB_ASSERTIONS=FALSE } # disabling stdlib assertions due to false positive
- platform: { name: macOS, os: macos-12 } - platform: { name: macOS, os: macos-12 }
config: { name: Frameworks, flags: -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE } config: { name: Frameworks, flags: -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE }
- platform: { name: macOS , os: macos-12 } - platform: { name: macOS , os: macos-12 }

View File

@ -204,6 +204,13 @@ if(SFML_ENABLE_SANITIZERS)
string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer -fno-sanitize-recover=all -fsanitize=undefined") string(APPEND CMAKE_CXX_FLAGS " -fno-omit-frame-pointer -fno-sanitize-recover=all -fsanitize=undefined")
endif() endif()
option(SFML_ENABLE_STDLIB_ASSERTIONS "Enable standard library assertions" OFF)
if(SFML_ENABLE_STDLIB_ASSERTIONS)
# intentionally using `add_definitions` here to propagate defines to subdirectories
add_definitions(-D_GLIBCXX_ASSERTIONS=1) # see https://gcc.gnu.org/wiki/LibstdcxxDebugMode
add_definitions(-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE) # see https://libcxx.llvm.org/Hardening.html
endif()
# set the output directory for SFML DLLs and executables # set the output directory for SFML DLLs and executables
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

View File

@ -10,6 +10,7 @@
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"SFML_BUILD_EXAMPLES": "ON", "SFML_BUILD_EXAMPLES": "ON",
"SFML_BUILD_TEST_SUITE": "ON", "SFML_BUILD_TEST_SUITE": "ON",
"SFML_ENABLE_STDLIB_ASSERTIONS": "ON",
"SFML_WARNINGS_AS_ERRORS": "ON" "SFML_WARNINGS_AS_ERRORS": "ON"
} }
} }