From f9eaf93d37957fb29eefb720022edd988c540369 Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Mon, 29 Mar 2021 19:11:17 -0600 Subject: MSVC: ASAN support for VS 16.9 This enables ASAN support when used with VS 16.9 enable as usual in cmake with the WITH_COMPILER_ASAN option, or when using make.bat just tag on `asan' to the invocation, ie: `make lite 2019 asan` MSVC: Asan support for 16.9 This enables ASAN support when used with VS 16.9 enable as usual in cmake with the WITH_COMPILER_ASAN option, or when using make.bat just tag on `asan' to the invocation, ie: `make lite 2019 asan` Differential Revision: https://developer.blender.org/D7794 Reviewed By: brecht, sergey --- source/creator/CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/creator') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index d9064682203..90840aa8358 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -693,6 +693,26 @@ elseif(WIN32) DESTINATION "." ) endif() + if(MSVC_ASAN) + # The asan dll's can be found in the same folder as the compiler, this is the easiest way to find these. + string(REPLACE "cl.exe" "clang_rt.asan_dynamic-x86_64.dll" ASAN_DLL ${CMAKE_C_COMPILER}) + string(REPLACE "cl.exe" "clang_rt.asan_dbg_dynamic-x86_64.dll" ASAN_DEBUG_DLL ${CMAKE_C_COMPILER}) + if(NOT EXISTS "${ASAN_DLL}") + message(FATAL_ERROR "Asan is enabled, but the ASAN runtime is not detected, this is an optional component during the MSVC install, please install it") + endif() + install( + FILES ${ASAN_DLL} + DESTINATION "." + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + ) + install( + FILES ${ASAN_DEBUG_DLL} + DESTINATION "." + CONFIGURATIONS Debug + ) + unset(ASAN_DLL) + unset(ASAN_DEBUG_DLL) + endif() if(WITH_GMP) install( -- cgit v1.2.3