File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ set(ARCH "x64" CACHE STRING "Arch")
66option (BUILD_SHARED "Option to build shared library" ON )
77option (BUILD_STATIC "Option to build static library" ON )
88option (POST_BUILD_COPY_EXT_LIBS "Option to copy external libraries to build directory" ON )
9+ option (ENABLE_SANITIZERS "Enable AddressSanitizer and UBSan for Debug builds" OFF )
910
1011message (STATUS "PLATFORM: ${PLATFORM} " )
1112message (STATUS "ARCH: ${ARCH} " )
@@ -67,6 +68,16 @@ set(CMAKE_C_STANDARD 99)
6768set (CMAKE_CXX_VISIBILITY_PRESET hidden)
6869set (CMAKE_C_VISIBILITY_PRESET hidden)
6970
71+ if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
72+ if (ENABLE_SANITIZERS AND (PLATFORM STREQUAL "macos" OR PLATFORM STREQUAL "linux" ))
73+ add_compile_options (-fsanitize=address)
74+ add_link_options (-fsanitize=address)
75+
76+ add_compile_options (-fsanitize=undefined)
77+ add_link_options (-fsanitize=undefined)
78+ endif ()
79+ endif ()
80+
7081set (DMDUTIL_SOURCES
7182 src/Config.cpp
7283 src/DMD.cpp
Original file line number Diff line number Diff line change 33set -e
44
55LIBZEDMD_SHA=154772800e8f36378c629f066bfee563862728ac
6- LIBSERUM_SHA=a6d43762884b36151ab4e967ebe04cc1a1dde4e8
6+ LIBSERUM_SHA=34e8ad23837b30acaade1e9aaa773d8ea3340622
77LIBPUPDMD_SHA=124f45e5ddd59ceb339591de88fcca72f8c54612
88
99if [ -z " ${BUILD_TYPE} " ]; then
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ cmake \
5959 -DARCH=arm64 \
6060 -DBUILD_SHARED=ON \
6161 -DBUILD_STATIC=OFF \
62+ -DENABLE_SANITIZERS=ON \
6263 -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
6364 -B build
6465cmake --build build -- -j${NUM_PROCS}
You can’t perform that action at this time.
0 commit comments