diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-05-28 23:34:47 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-05-28 23:34:47 +0300 |
commit | 81060ff6b26c22331d2066bb83d492bbe61e936c (patch) | |
tree | 1d173513b053c0cbbae6ab3b5f4b0a420bedb30f /build_files/build_environment/patches | |
parent | dc0eed178a0f71634399a61b929a544e554ef6aa (diff) |
Windows: Add support for building with clang.
This commit contains the minimum to make clang build/work with blender, asan and ninja build support is forthcoming
Things to note:
1) Builds and runs, and is able to pass all tests (except for the freestyle_stroke_material.blend test which was broken at that time for all platforms by the looks of it)
2) It's slightly faster than msvc when using cycles. (time in seconds, on an i7-3370)
victor_cpu
msvc:3099.51
clang:2796.43
pavillon_barcelona_cpu
msvc:1872.05
clang:1827.72
koro_cpu
msvc:1097.58
clang:1006.51
fishy_cat_cpu
msvc:815.37
clang:722.2
classroom_cpu
msvc:1705.39
clang:1575.43
bmw27_cpu
msvc:552.38
clang:561.53
barbershop_interior_cpu
msvc:2134.93
clang:1922.33
3) clang on windows uses a drop in replacement for the Microsoft cl.exe (takes some of the Microsoft parameters, but not all, and takes some of the clang parameters but not all) and uses ms headers + libraries + linker, so you still need visual studio installed and will use our existing vc14 svn libs.
4) X64 only currently, X86 builds but crashes on startup.
5) Tested with llvm/clang 6.0.0
6) Requires visual studio integration, available at https://github.com/LazyDodo/llvm-vs2017-integration
7) The Microsoft compiler spawns a few copies of cl in parallel to get faster build times, clang doesn't, so the build time is 3-4x slower than with msvc.
8) No openmp support yet. Have not looked at this much, the binary distribution of clang doesn't seem to include it on windows.
9) No ASAN support yet, some of the sanitizers can be made to work, but it was decided to leave support out of this commit.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3304
Diffstat (limited to 'build_files/build_environment/patches')
-rw-r--r-- | build_files/build_environment/patches/boost.diff | 22 | ||||
-rw-r--r-- | build_files/build_environment/patches/osl.diff | 26 |
2 files changed, 48 insertions, 0 deletions
diff --git a/build_files/build_environment/patches/boost.diff b/build_files/build_environment/patches/boost.diff index ea3ec035518..41b40d7a915 100644 --- a/build_files/build_environment/patches/boost.diff +++ b/build_files/build_environment/patches/boost.diff @@ -13,3 +13,25 @@ -# pragma message("Unknown compiler version - please run the configure tests and report the results") -# endif -#endif +--- a/boost/type_traits/has_nothrow_assign.hpp 2015-12-13 05:49:42 -0700 ++++ b/boost/type_traits/has_nothrow_assign.hpp 2018-05-27 11:11:02 -0600 +@@ -24,7 +24,7 @@ + #include <boost/type_traits/remove_reference.hpp> + #endif + #endif +-#if defined(__GNUC__) || defined(__SUNPRO_CC) ++#if defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__clang__) + #include <boost/type_traits/is_const.hpp> + #include <boost/type_traits/is_volatile.hpp> + #include <boost/type_traits/is_assignable.hpp> +--- a/boost/type_traits/has_nothrow_constructor.hpp 2015-12-13 05:49:42 -0700 ++++ b/boost/type_traits/has_nothrow_constructor.hpp 2018-05-27 11:11:02 -0600 +@@ -17,7 +17,7 @@ + #if defined(BOOST_MSVC) || defined(BOOST_INTEL) + #include <boost/type_traits/has_trivial_constructor.hpp> + #endif +-#if defined(__GNUC__ ) || defined(__SUNPRO_CC) ++#if defined(__GNUC__ ) || defined(__SUNPRO_CC) || defined(__clang__) + #include <boost/type_traits/is_default_constructible.hpp> + #endif + diff --git a/build_files/build_environment/patches/osl.diff b/build_files/build_environment/patches/osl.diff index fcb5ec4165f..960a2506374 100644 --- a/build_files/build_environment/patches/osl.diff +++ b/build_files/build_environment/patches/osl.diff @@ -10,3 +10,29 @@ diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_o MAIN_DEPENDENCY ${flexsrc} DEPENDS ${${compiler_headers}} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) +--- a/src/include/OSL/oslconfig.h 2016-10-31 16:48:19 -0600 ++++ b/src/include/OSL/oslconfig.h 2018-05-27 11:18:08 -0600 +@@ -44,12 +44,18 @@ + // same if another packages is compiling against OSL and using these headers + // (OSL may be C++11 but the client package may be older, or vice versa -- + // use these two symbols to differentiate these cases, when important). +-#if (__cplusplus >= 201402L) +-# define OSL_CPLUSPLUS_VERSION 14 +-#elif (__cplusplus >= 201103L) +-# define OSL_CPLUSPLUS_VERSION 11 ++ ++// Force C++03 for MSVC in blender since svn the libraries are build with that ++#if !defined(_MSC_VER) ++ #if (__cplusplus >= 201402L) ++ # define OSL_CPLUSPLUS_VERSION 14 ++ #elif (__cplusplus >= 201103L) ++ # define OSL_CPLUSPLUS_VERSION 11 ++ #else ++ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */ ++ #endif + #else +-# define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */ ++ # define OSL_CPLUSPLUS_VERSION 3 /* presume C++03 */ + #endif + + // Symbol export defines |