From 68e30aa968ecc94fb512650c80bf6b6f86b32ee7 Mon Sep 17 00:00:00 2001 From: blankie Date: Wed, 25 Jan 2023 12:38:12 +0700 Subject: [PATCH] Enable ubsan and tsan by default only if it's a debug build --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fad28a..7678193 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,12 +31,16 @@ set(SOURCES main.cpp event_loop.cpp logcat_thread.cpp logcat_entry.cpp log.cpp c set(IMGUI_SOURCES imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_widgets.cpp imgui/imgui_tables.cpp imgui/misc/cpp/imgui_stdlib.cpp imgui/misc/freetype/imgui_freetype.cpp imgui/backends/imgui_impl_sdl.cpp imgui/backends/imgui_impl_opengl3.cpp) + if (CMAKE_BUILD_TYPE STREQUAL "Debug") set(SOURCES ${SOURCES} windows/debug.cpp) set(IMGUI_SOURCES ${IMGUI_SOURCES} imgui/imgui_demo.cpp) + if ("${FLAGS}" STREQUAL "") + set(FLAGS "-fsanitize=undefined,thread") + endif() endif() -set(FLAGS "-fsanitize=undefined,thread -DIMGUI_USER_CONFIG='\"../myimconfig.h\"'") +set(FLAGS "${FLAGS} -DIMGUI_USER_CONFIG='\"../myimconfig.h\"'") # https://t.me/NightShadowsHangout/670691 set(FLAGS "${FLAGS} -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fno-rtti -fPIC -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough") # https://sourceforge.net/p/valgrind/mailman/valgrind-users/thread/Ygze8PzaQAYWlKDj%40wildebeest.org/