Browse Source

Build Source and SourceX with UBSAN by default

pull/344/head
Gleb Mazovetskiy 7 years ago committed by Anders Jenbo
parent
commit
1ea70f8ae8
  1. 4
      .editorconfig
  2. 7
      CMakeLists.txt

4
.editorconfig

@ -23,3 +23,7 @@ end_of_line = lf
[CMakeLists.txt]
indent_style = space
indent_size = 2
[*.cmake]
indent_style = space
indent_size = 2

7
CMakeLists.txt

@ -7,6 +7,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
option(ASAN "Enable address sanitizer" ON)
option(UBSAN "Enable undefined behaviour sanitizer" ON)
option(DEBUG "Enable debug mode in engine" ON)
option(SPAWN "Build the shareware version" OFF)
option(DIST "Dynamically link only glibc and SDL2" OFF)
@ -19,6 +20,7 @@ option(NONET "Disable network" OFF)
if(BINARY_RELEASE)
set(CMAKE_BUILD_TYPE "Release")
set(ASAN OFF)
set(UBSAN OFF)
set(DEBUG OFF)
set(DIST ON)
set(FASTER OFF)
@ -37,6 +39,7 @@ endif()
if(NIGHTLY_BUILD)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
set(ASAN OFF)
set(UBSAN OFF)
set(DEBUG ON)
set(DIST ON)
set(FASTER OFF)
@ -305,6 +308,10 @@ foreach(target devilution devilutionx)
target_compile_options(${target} PUBLIC -fsanitize=address -fsanitize-recover=address)
target_link_libraries(${target} PUBLIC -fsanitize=address -fsanitize-recover=address)
endif()
if(UBSAN)
target_compile_options(${target} PUBLIC -fsanitize=undefined)
target_link_libraries(${target} PUBLIC -fsanitize=undefined)
endif()
endforeach(target devilution devilutionx)
if(DIST AND CMAKE_CXX_COMPILER_ID MATCHES "GCC")

Loading…
Cancel
Save