[Bf-blender-cvs] [8a42100] master: Bullet: better workaround for failing friction with clang 3.4, remove the obsolete compileflag magic

Jens Verwiebe noreply at git.blender.org
Thu Apr 17 00:25:34 CEST 2014


Commit: 8a4210074c0d20af7aa1fe8b03839086f3f39078
Author: Jens Verwiebe
Date:   Thu Apr 17 00:25:15 2014 +0200
https://developer.blender.org/rB8a4210074c0d20af7aa1fe8b03839086f3f39078

Bullet: better workaround for failing friction with clang 3.4, remove the obsolete compileflag magic

===================================================================

M	extern/bullet2/CMakeLists.txt
M	extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
M	extern/bullet2/src/SConscript

===================================================================

diff --git a/extern/bullet2/CMakeLists.txt b/extern/bullet2/CMakeLists.txt
index 9cb6dcd..2b2c18c 100644
--- a/extern/bullet2/CMakeLists.txt
+++ b/extern/bullet2/CMakeLists.txt
@@ -401,12 +401,6 @@ set(SRC
 if(CMAKE_COMPILER_IS_GNUCXX)
 	# needed for gcc 4.6+
 	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
-
-endif()
-
-# Tentative fix for bullet misbehavior (T38746), needs further clarification what flags conflict here
-if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
-	SET_SOURCE_FILES_PROPERTIES(src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp COMPILE_FLAGS "-O0")
 endif()
 
 blender_add_lib(extern_bullet "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
index 27ccefe..1a6b187 100644
--- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
+++ b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
@@ -37,8 +37,13 @@ struct	btSimdScalar
 	{
 
 	}
-
+/* workaround for an clang 3.4 issue, friction would fail with forced inlining */
+#if (defined(__APPLE__) && defined(__clang__) && (__clang_major__ == 5) && (__clang_minor__ == 1)) \
+	|| (defined(__clang__) && (__clang_major__ == 3) && (__clang_minor__ == 4))
+	inline __attribute__ ((noinline)) btSimdScalar(float	fl)
+#else
 	SIMD_FORCE_INLINE	btSimdScalar(float	fl)
+#endif
 	:m_vec128 (_mm_set1_ps(fl))
 	{
 	}
diff --git a/extern/bullet2/src/SConscript b/extern/bullet2/src/SConscript
index 6e51d06..20a87d5 100644
--- a/extern/bullet2/src/SConscript
+++ b/extern/bullet2/src/SConscript
@@ -19,8 +19,7 @@ elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
     cflags += ['-O2']
 elif sys.platform=='darwin':
     defs += ' NDEBUG'
-    bt_flags = env['CCFLAGS'] + ['-fPIC', '-msse','-msse2', '-msse3', '-mssse3'] # basic -O0 optimization
-    bt_opt_flags = bt_flags + ['-O3']
+    cflags += ['-O3','-fPIC']
 
 bullet2_src = env.Glob("LinearMath/*.cpp")
 bullet2_src += env.Glob("BulletCollision/BroadphaseCollision/*.cpp")
@@ -38,15 +37,4 @@ bullet2_src += env.Glob("BulletSoftBody/*.cpp")
 
 incs = '. BulletCollision BulletDynamics LinearMath BulletSoftBody'
 
-if sys.platform=='darwin':
-    if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
-        # Due some bugs in bullet, clang 3.4 produces wrong code when optimized > -O0
-        # to avoid too much speed penalty when compiling whole bullet lib non-optimized,
-        # we build seperate non-optimized/optimized parts and just link together finally
-        bullet2_src.remove("BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp")
-        bullet2_fix_src = env.Glob("BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp")
-        env.BlenderLib ( libname = 'extern_fix_bullet2', sources=bullet2_fix_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], cc_compileflags=bt_flags, cxx_compileflags=bt_flags )
-		
-    env.BlenderLib ( libname = 'extern_bullet2', sources=bullet2_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], cc_compileflags=bt_opt_flags, cxx_compileflags=bt_opt_flags )
-else:
-	env.BlenderLib ( libname = 'extern_bullet2', sources=bullet2_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], compileflags=cflags )
+env.BlenderLib ( libname = 'extern_bullet2', sources=bullet2_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], compileflags=cflags )




More information about the Bf-blender-cvs mailing list