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
path: root/extern
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2018-05-28 23:34:47 +0300
committerRay Molenkamp <github@lazydodo.com>2018-05-28 23:34:47 +0300
commit81060ff6b26c22331d2066bb83d492bbe61e936c (patch)
tree1d173513b053c0cbbae6ab3b5f4b0a420bedb30f /extern
parentdc0eed178a0f71634399a61b929a544e554ef6aa (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 'extern')
-rw-r--r--extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h2
-rw-r--r--extern/Eigen3/patches/blender.diff12
-rw-r--r--extern/bullet2/patches/blender.patch31
-rw-r--r--extern/bullet2/src/LinearMath/btScalar.h7
4 files changed, 49 insertions, 3 deletions
diff --git a/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h b/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
index fc8ae50fed7..cb535e1b78f 100644
--- a/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
+++ b/extern/Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
@@ -335,7 +335,7 @@ template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { _mm_p
template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
-#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
+#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__)
// The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
// Direct of the struct members fixed bug #62.
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }
diff --git a/extern/Eigen3/patches/blender.diff b/extern/Eigen3/patches/blender.diff
new file mode 100644
index 00000000000..3d7ba6e7006
--- /dev/null
+++ b/extern/Eigen3/patches/blender.diff
@@ -0,0 +1,12 @@
+diff -Naur c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h
+--- c:\blender-git\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-25 13:29:14 -0600
++++ k:\BlenderGit\blender\extern\Eigen3/Eigen/src/Core/arch/SSE/PacketMath.h 2018-05-26 19:56:36 -0600
+@@ -335,7 +335,7 @@
+ template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+ template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }
+
+-#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER)
++#if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+ // The temporary variable fixes an internal compilation error in vs <= 2008 and a wrong-result bug in vs 2010
+ // Direct of the struct members fixed bug #62.
+ template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { return a.m128_f32[0]; }
diff --git a/extern/bullet2/patches/blender.patch b/extern/bullet2/patches/blender.patch
index 96357ddd315..cb3bf2ba38a 100644
--- a/extern/bullet2/patches/blender.patch
+++ b/extern/bullet2/patches/blender.patch
@@ -1,3 +1,34 @@
+diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
+--- a/extern/bullet2/src/LinearMath/btScalar.h
++++ b/extern/bullet2/src/LinearMath/btScalar.h
+@@ -16,6 +16,9 @@
+
+ #ifndef BT_SCALAR_H
+ #define BT_SCALAR_H
++#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
++#define BT_NO_SIMD_OPERATOR_OVERLOADS
++#endif
+
+ #ifdef BT_MANAGED_CODE
+ //Aligned data types not supported in managed code
+@@ -83,7 +86,7 @@
+ #ifdef BT_USE_SSE
+
+ #if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
+- #define BT_ALLOW_SSE4
++ //#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
+ #endif //(_MSC_FULL_VER >= 160040219)
+
+ //BT_USE_SSE_IN_API is disabled under Windows by default, because
+@@ -102,7 +105,7 @@
+ #endif //__MINGW32__
+
+ #ifdef BT_DEBUG
+- #ifdef _MSC_VER
++ #if defined(_MSC_VER) && !defined(__clang__)
+ #include <stdio.h>
+ #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
+ #else//_MSC_VER
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
index be9eca6..ec40c96 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
index 0bfd255bdb4..898669f86e2 100644
--- a/extern/bullet2/src/LinearMath/btScalar.h
+++ b/extern/bullet2/src/LinearMath/btScalar.h
@@ -16,6 +16,9 @@ subject to the following restrictions:
#ifndef BT_SCALAR_H
#define BT_SCALAR_H
+#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
+#define BT_NO_SIMD_OPERATOR_OVERLOADS
+#endif
#ifdef BT_MANAGED_CODE
//Aligned data types not supported in managed code
@@ -83,7 +86,7 @@ inline int btGetVersion()
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
- #define BT_ALLOW_SSE4
+ //#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
#endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because
@@ -102,7 +105,7 @@ inline int btGetVersion()
#endif //__MINGW32__
#ifdef BT_DEBUG
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) && !defined(__clang__)
#include <stdio.h>
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
#else//_MSC_VER