Skip to content
Snippets Groups Projects
Commit 8fbf3b43 authored by Kitty Barnett's avatar Kitty Barnett
Browse files

Add ASan as a build option now that Visual Studio supports it

parent c750a5ac
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "$ENV{LL_BUILD_DEBUG}")
# Portable compilation flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DADDRESS_SIZE=${ADDRESS_SIZE}")
# Configure asan
set(ASAN OFF CACHE BOOL "Enable use of asan in builds")
# Configure crash reporting
set(RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in release builds")
set(NON_RELEASE_CRASH_REPORTING OFF CACHE BOOL "Enable use of crash reporting in developer builds")
......@@ -63,6 +66,10 @@ if (WINDOWS)
# http://www.cmake.org/pipermail/cmake/2009-September/032143.html
string(REPLACE "/Zm1000" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if(ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address")
endif(ASAN)
# Without PreferredToolArchitecture=x64, as of 2020-06-26 the 32-bit
# compiler on our TeamCity build hosts has started running out of virtual
# memory for the precompiled header file.
......
......@@ -18,6 +18,13 @@ macro(ll_deploy_sharedlibs_command target_exe)
if(NOT DARWIN)
if(WINDOWS)
SET_TEST_PATH(SEARCH_DIRS)
if(ASAN)
if(ADDRESS_SIZE EQUAL 32)
LIST(APPEND SEARCH_DIRS "$ENV{VCToolsInstallDir}bin\\Hostx64\\x86")
else(ADDRESS_SIZE EQUAL 32)
LIST(APPEND SEARCH_DIRS "$ENV{VCToolsInstallDir}bin\\Hostx64\\x64")
endif(ADDRESS_SIZE EQUAL 32)
endif(ASAN)
LIST(APPEND SEARCH_DIRS "$ENV{SystemRoot}/system32")
elseif(LINUX)
SET_TEST_PATH(SEARCH_DIRS)
......
......@@ -69,6 +69,22 @@ if (WINDOWS)
ole32
dbghelp
)
if(ASAN)
if(ADDRESS_SIZE EQUAL 32)
set(WINDOWS_LIBRARIES
${WINDOWS_LIBRARIES}
clang_rt.asan_dynamic_runtime_thunk-i386
clang_rt.asan_dynamic-i386
)
else(ADDRESS_SIZE EQUAL 32)
set(WINDOWS_LIBRARIES
${WINDOWS_LIBRARIES}
clang_rt.asan_dynamic_runtime_thunk-x86_64
clang_rt.asan_dynamic-x86_64
)
endif(ADDRESS_SIZE EQUAL 32)
endif(ASAN)
else (WINDOWS)
set(WINDOWS_LIBRARIES "")
endif (WINDOWS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment