Fix T39646: Rigid Body Constraints non functional on release builds
[blender.git] / extern / bullet2 / src / SConscript
1 #!/usr/bin/python
2 import sys
3 import os
4
5 Import('env')
6
7 defs = ''
8 cflags = []
9
10 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
11     defs += ' WIN32 NDEBUG _WINDOWS'
12     #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
13     cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs']
14 elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'):
15     defs += ' NDEBUG'
16     cflags += ['-O2']
17 elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
18     defs += ' NDEBUG'
19     cflags += ['-O2']
20 elif sys.platform=='darwin':
21     defs += ' NDEBUG'
22     bt_flags = env['CCFLAGS'] + ['-fPIC', '-msse','-msse2', '-msse3', '-mssse3'] # basic -O0 optimization
23     bt_opt_flags = bt_flags + ['-O3']
24
25 bullet2_src = env.Glob("LinearMath/*.cpp")
26 bullet2_src += env.Glob("BulletCollision/BroadphaseCollision/*.cpp")
27 bullet2_src += env.Glob("BulletCollision/CollisionDispatch/*.cpp")
28 bullet2_src += env.Glob("BulletCollision/Gimpact/*.cpp")
29 bullet2_src += env.Glob("BulletCollision/CollisionShapes/*.cpp")
30 bullet2_src += env.Glob("BulletCollision/NarrowPhaseCollision/*.cpp")
31 bullet2_src += env.Glob("BulletDynamics/Vehicle/*.cpp")
32 bullet2_src += env.Glob("BulletDynamics/ConstraintSolver/*.cpp")
33 bullet2_src += env.Glob("BulletDynamics/Dynamics/*.cpp")
34 bullet2_src += env.Glob("BulletDynamics/Character/*.cpp")
35 bullet2_src += env.Glob("BulletDynamics/Featherstone/*.cpp")
36 bullet2_src += env.Glob("BulletDynamics/MLCPSolvers/*.cpp")
37 bullet2_src += env.Glob("BulletSoftBody/*.cpp")
38
39 incs = '. BulletCollision BulletDynamics LinearMath BulletSoftBody'
40
41 if sys.platform=='darwin':
42     if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
43         # Due some bugs in bullet, clang 3.4 produces wrong code when optimized > -O0
44         # to avoid too much speed penalty when compiling whole bullet lib non-optimized,
45         # we build seperate non-optimized/optimized parts and just link together finally
46         bullet2_src.remove("BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp")
47         bullet2_fix_src = env.Glob("BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp")
48         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 )
49                 
50     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 )
51 else:
52         env.BlenderLib ( libname = 'extern_bullet2', sources=bullet2_src, includes=Split(incs), defines=Split(defs), libtype=['extern','player'], priority=[20,137], compileflags=cflags )