Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2018-05-31 20:50:30 +0300
committerRay Molenkamp <github@lazydodo.com>2018-05-31 20:50:30 +0300
commit7c75c2db4f97e192d76761afe0cdb4391bdc0ec1 (patch)
treee74d5681b8bc4d1bd12c4253aca1dabab2edff30 /build_files
parentcfea9c261c2349e03c5ce38a04659479901ce815 (diff)
Add Asan support for clang on windows.
This will currently only work for the RelWithDebInfo configuration since asan does not support the debug crt. for source line information in the reports, you need a copy of llvm-symbolizer in the blender folder or set the ASAN_SYMBOLIZER_PATH environment variable to point to it. Currently (as of 6.0.0) llvm-symbolizer does not ship with the binary clang/llvm distribution. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D3446
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/macros.cmake5
-rw-r--r--build_files/cmake/platform/platform_win32.cmake4
-rw-r--r--build_files/windows/configure_msbuild.cmd8
-rw-r--r--build_files/windows/configure_ninja.cmd10
-rw-r--r--build_files/windows/parse_arguments.cmd2
-rw-r--r--build_files/windows/reset_variables.cmd3
6 files changed, 29 insertions, 3 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index abf8da11c8e..11fc3e110c1 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -352,6 +352,11 @@ function(SETUP_LIBDIRS)
endif()
endfunction()
+macro(setup_platform_linker_flags)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
+endmacro()
+
function(setup_liblinks
target
)
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 3c35851bc5f..6e049c0048f 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -149,7 +149,7 @@ set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
-set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
+set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO ")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib ")
# Ignore meaningless for us linker warnings.
@@ -162,7 +162,7 @@ else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
endif()
-set(PLATFORM_LINKFLAGS_DEBUG "/IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
+set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
if(NOT DEFINED LIBDIR)
diff --git a/build_files/windows/configure_msbuild.cmd b/build_files/windows/configure_msbuild.cmd
index f06f3e317ee..eee21f568be 100644
--- a/build_files/windows/configure_msbuild.cmd
+++ b/build_files/windows/configure_msbuild.cmd
@@ -12,6 +12,14 @@ if "%BUILD_ARCH%"=="x64" (
if "%WITH_CLANG%"=="1" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
+ if "%WITH_ASAN%"=="1" (
+ set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
+ )
+) else (
+ if "%WITH_ASAN%"=="1" (
+ echo ASAN is only supported with clang.
+ exit /b 1
+ )
)
if NOT EXIST %BUILD_DIR%\nul (
diff --git a/build_files/windows/configure_ninja.cmd b/build_files/windows/configure_ninja.cmd
index f882ca3dbf0..d3b002e9a24 100644
--- a/build_files/windows/configure_ninja.cmd
+++ b/build_files/windows/configure_ninja.cmd
@@ -27,6 +27,16 @@ set LLVM_DIR=
rem build and tested against 2017 15.7
set CFLAGS=-m64 -fmsc-version=1914
set CXXFLAGS=-m64 -fmsc-version=1914
+ if "%WITH_ASAN%"=="1" (
+ set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
+ )
+)
+
+if "%WITH_ASAN%"=="1" (
+ if "%WITH_CLANG%" == "" (
+ echo ASAN is only supported with clang.
+ exit /b 1
+ )
)
if NOT "%verbose%" == "" (
diff --git a/build_files/windows/parse_arguments.cmd b/build_files/windows/parse_arguments.cmd
index a8956d350ae..2cc0acfd243 100644
--- a/build_files/windows/parse_arguments.cmd
+++ b/build_files/windows/parse_arguments.cmd
@@ -42,6 +42,8 @@ if NOT "%1" == "" (
) else if "%1" == "release" (
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -C"%BLENDER_DIR%\build_files\cmake\config\blender_release.cmake"
set TARGET=Release
+ ) else if "%1" == "asan" (
+ set WITH_ASAN=1
) else if "%1" == "x86" (
set BUILD_ARCH=x86
) else if "%1" == "x64" (
diff --git a/build_files/windows/reset_variables.cmd b/build_files/windows/reset_variables.cmd
index d9a50a7f809..f933729b91c 100644
--- a/build_files/windows/reset_variables.cmd
+++ b/build_files/windows/reset_variables.cmd
@@ -21,4 +21,5 @@ set BUILD_UPDATE=
set BUILD_SHOW_HASHES=
set SHOW_HELP=
set BUILD_WITH_NINJA=
-set WITH_CLANG= \ No newline at end of file
+set WITH_CLANG=
+set WITH_ASAN= \ No newline at end of file