Skip to content

Commit ed2cf9b

Browse files
committed
@AnastaZIuk needs to clean this shit up and complete it
1 parent 81c92dc commit ed2cf9b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;")
8787
set(LLVM_USE_CRT_DEBUG MTd CACHE STRING "Nabla developer note: No idea what subfolder provides this")
8888
set(LLVM_USE_CRT_RELEASE MT CACHE STRING "Nabla developer note: No idea what subfolder provides this")
8989

90+
unset(CMAKE_CXX_FLAGS_DEBUG CACHE)
91+
unset(CMAKE_CXX_FLAGS_DEBUG)
92+
#set(CMAKE_CXX_FLAGS_DEBUG /Zi /Ob0 /Od /MTd)
93+
9094
if(NOT CMAKE_BUILD_TYPE)
9195
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type: Debug or Release" FORCE)
9296
endif()
@@ -100,6 +104,14 @@ endif()
100104
macro(nbl_adjust_flags)
101105
option(NBL_SANITIZE_ADDRESS OFF)
102106

107+
# test
108+
add_compile_options("/fsanitize=adress")
109+
add_compile_options("-fsanitize=adress")
110+
#add_link_options("/fsanitize=address")
111+
112+
# TODO: AnastaZIuk please clean it later or somebody
113+
#message(FATAL_ERROR "${CMAKE_CXX_FLAGS_DEBUG}")
114+
103115
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
104116
option(NBL_SANITIZE_THREAD OFF)
105117
endif()
@@ -185,9 +197,9 @@ macro(nbl_adjust_flags)
185197
elseif(MSVC) # /arch:sse3 or anything like this is not needed on x64 on MSVC for enabling sse3 instructions
186198
if (NBL_SANITIZE_ADDRESS)
187199
set(NBL_MSVC_FLAG_SANITIZE_ADDRESS "/fsanitize=address")
188-
message(WARNING "Due to https://github.com/google/sanitizers/issues/328 expect not to be able to use the Debug target!")
189-
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /wholearchive:clang_rt.asan_dbg-x86_64.lib /wholearchive:clang_rt.asan_cxx_dbg-x86_64.lib")
190-
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /wholearchive:clang_rt.asan-x86_64.lib /wholearchive:clang_rt.asan_cxx-x86_64.lib")
200+
#message(WARNING "Due to https://github.com/google/sanitizers/issues/328 expect not to be able to use the Debug target!")
201+
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /wholearchive:clang_rt.asan_dbg-x86_64.lib /wholearchive:clang_rt.asan_cxx_dbg-x86_64.lib -fno-omit-frame-pointer -fsanitize=address")
202+
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /wholearchive:clang_rt.asan-x86_64.lib /wholearchive:clang_rt.asan_cxx-x86_64.lib -fno-omit-frame-pointer -fsanitize=address")
191203
endif()
192204

193205
# debug

cmake/common.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ macro(nbl_create_executable_project _EXTRA_SOURCES _EXTRA_OPTIONS _EXTRA_INCLUDE
7575
target_link_libraries(${EXECUTABLE_NAME} PUBLIC Nabla ${_EXTRA_LIBS}) # see, this is how you should code to resolve github issue 311
7676

7777
add_compile_options(${_EXTRA_OPTIONS})
78+
79+
target_compile_options(${EXECUTABLE_NAME} PUBLIC "-fsanitize=address")
7880

7981
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
8082
# add_compile_options("-msse4.2 -mfpmath=sse") ????

0 commit comments

Comments
 (0)