Sanitizers
This commit is contained in:
parent
28998a0087
commit
868809bb5d
|
|
@ -5,6 +5,7 @@ include(FindPackageHandleStandardArgs)
|
||||||
# Options
|
# Options
|
||||||
option(STEAM "Build for Steam" OFF)
|
option(STEAM "Build for Steam" OFF)
|
||||||
option(DEBUG "Debug mode" OFF)
|
option(DEBUG "Debug mode" OFF)
|
||||||
|
option(SANITIZERS "Enable sanitizers" OFF)
|
||||||
option(NATIVE "Use native instructions(for local use only)" OFF)
|
option(NATIVE "Use native instructions(for local use only)" OFF)
|
||||||
#x86, arm64, ia-64
|
#x86, arm64, ia-64
|
||||||
option(CPU_ARCH "Enter here your target arch" "x86")
|
option(CPU_ARCH "Enter here your target arch" "x86")
|
||||||
|
|
@ -310,12 +311,23 @@ source_group("Binding Source" FILES ${BINDING_SOURCE} ${BINDING_HEADERS})
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
list(APPEND DEFINES _CRT_SECURE_NO_WARNINGS NOMINMAX )
|
list(APPEND DEFINES _CRT_SECURE_NO_WARNINGS NOMINMAX )
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
add_compile_options(/EHr /fsanitize /validate-charset /DEBUG /RTCu /RTCs /RTCc)
|
add_compile_options(/EHr /validate-charset /DEBUG /RTCu /RTCs /RTCc)
|
||||||
else()
|
else()
|
||||||
add_compile_options(/O2 /fp:fast /GL /GF /GA /Gy)
|
add_compile_options(/O2 /fp:fast /GL /GF /GA /Gy)
|
||||||
add_link_options(/LTCG /OPT:REF /OPT:ICF)
|
add_link_options(/LTCG /OPT:REF /OPT:ICF)
|
||||||
endif()
|
endif()
|
||||||
|
if(SANITIZERS)
|
||||||
|
add_compile_options(/fsanitize=address /fsanitize=fuzzer /fsanitize-address-use-after-return)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
|
if(NATIVE)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
if(SANITIZERS)
|
||||||
|
set(SANITIZERS "address,undefined,leak,shift,shift-base,shift-exponent,integer-divide-by-zero,unreachable,vla-bound,null,signed-integer-overflow,bounds,bounds-strict,alignment,object-size,float-divide-by-zero,float-cast-overflow,nonnull-attribute,returns-nonnull-attribute,bool,enum,vptr,pointer-overflow,builtin,pointer-subtract,pointer-compare")
|
||||||
|
add_compile_options(-fsanitize=${SANITIZERS})
|
||||||
|
add_link_options(-fsanitize=${SANITIZERS})
|
||||||
|
endif()
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
add_compile_options(-g3 -fno-omit-frame-pointer)
|
add_compile_options(-g3 -fno-omit-frame-pointer)
|
||||||
else()
|
else()
|
||||||
|
|
@ -370,8 +382,6 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###############
|
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_library(main SHARED
|
add_library(main SHARED
|
||||||
${MAIN_HEADERS}
|
${MAIN_HEADERS}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue