Added support for compiling BULLET with scons on windows
authorSimon Clitherow <aphex@nildram.co.uk>
Mon, 1 Aug 2005 21:19:41 +0000 (21:19 +0000)
committerSimon Clitherow <aphex@nildram.co.uk>
Mon, 1 Aug 2005 21:19:41 +0000 (21:19 +0000)
using bandoler's patch as a basis (thanks!).

A couple of notes:

-  This is for windows only, I did not have a chance to try linux yet.

-  SConscript for PHY_Bullet may need tweaking (plus support
 for other platforms), but at least it's in there :)

Any problems, shout :)

SConstruct
extern/SConscript
extern/bullet/SConscript
source/blender/makesdna/intern/SConscript
source/gameengine/BlenderRoutines/SConscript
source/gameengine/Converter/SConscript
source/gameengine/Ketsji/SConscript
source/gameengine/Physics/Bullet/SConscript [new file with mode: 0644]
source/gameengine/SConscript
tools/scons/bs/bs_libs.py

index 1ff6d4a574762863196d7e31c2a3a9c3c919d1ae..73d506405a483562e355894720e740bba95b09cc 100644 (file)
@@ -331,8 +331,9 @@ elif sys.platform == 'win32':
        use_openal = 'true'
        use_fmod = 'false'
        use_quicktime = 'true'
-       use_sumo = 'true'
+       use_sumo = 'false'
        use_ode = 'false'
+       use_bullet = 'true'
        use_buildinfo = 'true'
        build_blender_dynamic = 'true'
        build_blender_static = 'false'
@@ -402,6 +403,10 @@ elif sys.platform == 'win32':
        qhull_lib = ['qhull']
        qhull_libpath = ['#../lib/windows/qhull/lib']
        qhull_include = ['#extern/qhull/include']
+       # Bullet library information
+       bullet_lib = []
+       bullet_libpath = []
+       bullet_include = ['#extern/bullet','#extern/bullet/LinearMath','#extern/bullet/Bullet','#extern/bullet/BulletDynamics']
        # ODE library information
        ode_lib = []                                                                                            # TODO
        ode_libpath = ['#../lib/windows/ode/lib']
@@ -794,6 +799,8 @@ else:
        config.write ("BUILD_GAMEENGINE = %r\n"%(use_gameengine))
        if use_ode == 'true':
                config.write ("USE_PHYSICS = 'ode'\n")
+       elif use_bullet == 'true':
+               config.write("USE_PHYSICS = 'bullet'\n")
        else:
                config.write ("USE_PHYSICS = 'solid'\n")
        config.write ("USE_OPENAL = %r\n"%(use_openal))
@@ -842,6 +849,9 @@ else:
        config.write ("ODE_INCLUDE = %r\n"%(ode_include))
        config.write ("ODE_LIBPATH = %r\n"%(ode_libpath))
        config.write ("ODE_LIBRARY = %r\n"%(ode_lib))
+       config.write ("BULLET_INCLUDE = %r\n"%(bullet_include))
+       config.write ("BULLET_LIBPATH = %r\n"%(bullet_libpath))
+       config.write ("BULLET_LIBRARY = %r\n"%(bullet_lib))
        config.write ("OPENAL_INCLUDE = %r\n"%(openal_include))
        config.write ("OPENAL_LIBPATH = %r\n"%(openal_libpath))
        config.write ("OPENAL_LIBRARY = %r\n"%(openal_lib))
@@ -891,7 +901,7 @@ user_options.AddOptions (
                                        'false')),
                (EnumOption ('USE_PHYSICS', 'solid',
                                        'Select which physics engine to use.',
-                                       allowed_values = ('ode', 'solid'))),
+                                       allowed_values = ('ode', 'solid', 'bullet'))),
                (BoolOption ('BUILD_GAMEENGINE',
                                        'Set to 1 to build blender with game engine support.',
                                        'false')),
@@ -943,6 +953,9 @@ user_options.AddOptions (
                ('ODE_INCLUDE', 'Include directory for ODE header files.'),
                ('ODE_LIBPATH', 'Library path where the ODE library is located.'),
                ('ODE_LIBRARY', 'ODE library name.'),
+               ('BULLET_INCLUDE', 'Include directory for BULLET header files.'),
+               ('BULLET_LIBPATH', 'Library path where the BULLET library is located.'),
+               ('BULLET_LIBRARY', 'BULLET library name'),
                ('OPENAL_INCLUDE', 'Include directory for OpenAL header files.'),
                ('OPENAL_LIBPATH', 'Library path where the OpenAL library is located.'),
                ('OPENAL_LIBRARY', 'OpenAL library name.'),
@@ -980,6 +993,8 @@ if user_options_dict['BUILD_GAMEENGINE'] == 1:
        defines += ['GAMEBLENDER=1']
        if user_options_dict['USE_PHYSICS'] == 'ode':
                defines += ['USE_ODE']
+       elif user_options_dict['USE_PHYSICS'] == 'bullet':
+               defines += ['USE_BULLET']
        else:
                defines += ['USE_SUMO_SOLID']
 else:
index f5f4267988dbb523e43b21f263b672559ba0ef7e..d11db23ab7ab2a71ba1fa1cd1665988a145f72f5 100644 (file)
@@ -5,7 +5,8 @@ Import('user_options_dict')
 
 print "externs..."
 SConscript(['qhull/SConscript',
-            'solid/SConscript'])
+            'solid/SConscript',
+           'bullet/SConscript'])
             
             
 if user_options_dict['USE_INTERNATIONAL'] == 1:
index b32d43c070509e8e6157ed1b0fc457ec57cda0aa..ae3763d6e45690385315c58484d0d86855d72290 100644 (file)
@@ -83,7 +83,7 @@ bullet_sources = ['Bullet/BroadphaseCollision/BroadphaseProxy.cpp',
                                
                                'BulletDynamics/ConstraintSolver/ContactConstraint.cpp',
                                'BulletDynamics/ConstraintSolver/OdeConstraintSolver.cpp',
-                               'BulletDynamics/ConstraintSolver/OdeConstraintSolver2.cpp',
+                               #'BulletDynamics/ConstraintSolver/OdeConstraintSolver2.cpp',
                                'BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp',
                                'BulletDynamics/ConstraintSolver/SimpleConstraintSolver.cpp',
                                'BulletDynamics/ConstraintSolver/Solve2LinearConstraint.cpp',
@@ -101,4 +101,4 @@ bullet_env.Append (CPPPATH = ['.',
                              ])
 source_files = bullet_sources 
 
-bullet_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/extern_bullet', source=source_files)
+bullet_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/extern_bullet', source=bullet_sources)
index 10c7eda9730c6fc97f31fcbe829c5840bdfcda34..378f2492e3c1e2537cf478cfbf9bf33de4751fad 100644 (file)
@@ -25,7 +25,7 @@ makesdna_tool.Append (LIBPATH = '#'+user_options_dict['BUILD_DIR']+'/lib')
 makesdna_tool.Append (LIBS = 'blender_guardedalloc')
 makesdna_tool.Program (target = '#'+user_options_dict['BUILD_DIR']+'makesdna', source = source_files)
 
-dna = Environment ()
+dna = Environment (ENV = os.environ)
 dna_dict = dna.Dictionary()
 makesdna_name = user_options_dict['BUILD_DIR']+'makesdna' + dna_dict['PROGSUFFIX']
 dna.Depends ('dna.c', '#'+makesdna_name)
index 6427c7c155f75558a289975de55bec51cc03cefa..f586e72ad444f35a46e03cd7c4d6d6d2d27aa28e 100755 (executable)
@@ -35,6 +35,7 @@ kx_blenderhook_env.Append (CPPPATH=['.',
                                     '#source/gameengine/Network',
                                     '#source/gameengine/SceneGraph',
                                     '#source/gameengine/Physics/common',
+                                    '#source/gameengine/Physics/Bullet',
                                     '#source/gameengine/Physics/Sumo',
                                     '#source/gameengine/Physics/Sumo/Fuzzics/include',
                                     '#source/gameengine/Network/LoopBackNetwork',
@@ -45,6 +46,7 @@ kx_blenderhook_env.Append (CPPPATH=['.',
 
 kx_blenderhook_env.Append (CPPPATH = user_options_dict['PYTHON_INCLUDE'])
 kx_blenderhook_env.Append (CPPPATH = user_options_dict['SOLID_INCLUDE'])
+kx_blenderhook_env.Append (CPPPATH = user_options_dict['BULLET_INCLUDE'])
 kx_blenderhook_env.Append (CPPPATH = user_options_dict['OPENGL_INCLUDE'])
 
 if sys.platform=='win32':
index 780295783d162bda292852e7a7e994030373756c..00908defdff14b502c520395a951c075b8ca7574 100755 (executable)
@@ -49,6 +49,7 @@ kx_converter_env.Append (CPPPATH = ['.',
                                     '#source/gameengine/Network',
                                     '#source/gameengine/SceneGraph',
                                     '#source/gameengine/Physics/common',
+                                    '#source/gameengine/Physics/Bullet',
                                     '#source/gameengine/Physics/BlOde',
                                     '#source/gameengine/Physics/Dummy',
                                     '#source/gameengine/Physics/Sumo',
@@ -60,5 +61,6 @@ kx_converter_env.Append (CPPPATH = ['.',
 
 kx_converter_env.Append (CPPPATH = user_options_dict['PYTHON_INCLUDE'])
 kx_converter_env.Append (CPPPATH = user_options_dict['SOLID_INCLUDE'])
+kx_converter_env.Append (CPPPATH = user_options_dict['BULLET_INCLUDE'])
 
 kx_converter_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/KX_converter', source=source_files)
index 1b22231f3f9085bfd741dba5da3c7b5d1c0be058..aa74e4e29c7e6eecc90ecbc71720da8dd70136b4 100644 (file)
@@ -68,6 +68,11 @@ if user_options_dict['USE_PHYSICS'] == 'ode':
     source_files += ['KX_OdePhysicsController.cpp']
     ketsji_env.Append (CPPPATH = user_options_dict['SOLID_INCLUDE'])
 
+if user_options_dict['USE_PHYSICS'] == 'bullet':
+    source_files += ['KX_BulletPhysicsController.cpp']
+    ketsji_env.Append (CPPPATH = user_options_dict['BULLET_INCLUDE'])
+    ketsji_env.Append (CPPPATH = user_options_dict['SOLID_INCLUDE'])
+
 ketsji_env.Append (CPPPATH = ['.',
                               '#source/kernel/gen_system',
                               '#intern/string',
@@ -97,6 +102,7 @@ ketsji_env.Append (CPPPATH = ['.',
                               '#source/gameengine/Network',
                               '#source/gameengine/SceneGraph',
                               '#source/gameengine/Physics/common',
+                              '#source/gameengine/Physics/Bullet',
                               '#source/gameengine/Physics/BlOde',
                               '#source/gameengine/Physics/Dummy',
                               '#source/gameengine/Physics/Sumo',
diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript
new file mode 100644 (file)
index 0000000..8d82f34
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+import sys
+Import ('user_options_dict')
+Import ('library_env')
+
+phy_bullet_env = library_env.Copy ()
+
+source_files = ['CcdPhysicsEnvironment.cpp',
+                'CcdPhysicsController.cpp'
+               ]
+
+phy_bullet_env.Append (CPPPATH=['.', 
+                               '../common'])
+
+phy_bullet_env.Append (CPPPATH = user_options_dict['BULLET_INCLUDE'])
+
+
+if sys.platform=='win32':
+       phy_bullet_env.Append (CXXFLAGS = ['/GR'])
+       phy_bullet_env.Append (CCFLAGS =['/O2'])
+
+phy_bullet_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/PHY_Bullet', source=source_files)
index 1b2c6316c6177e2649797209aeae1ec8ffa2b50d..496d9dc8f3cae5ffee700786c48c8241bcc5672c 100644 (file)
@@ -22,3 +22,5 @@ if user_options_dict['USE_PHYSICS'] == 'solid':
     SConscript(['Physics/Sumo/SConscript'])
 elif user_options_dict['USE_PHYSICS'] == 'ode':
     SConscript(['Physics/BlOde/SConscript'])
+elif user_options_dict['USE_PHYSICS'] == 'bullet':
+    SConscript(['Physics/Bullet/SConscript'])
index a2ed8a002c572160df6e1191125dc4c05fb2ac42..83cf6f1c2436585017f9112d95118bcbdc134a2f 100644 (file)
@@ -87,6 +87,8 @@ def ketsji_libs(env):
                                'NG_loopbacknetwork'])
                if bs_globals.user_options_dict['USE_PHYSICS'] == 'solid':
                        env.Append (LIBS=['PHY_Sumo', 'PHY_Physics', 'blender_MT', 'extern_solid', 'extern_qhull'])
+               elif bs_globals.user_options_dict['USE_PHYSICS'] == 'bullet':
+                       env.Append (LIBS=['PHY_Bullet', 'PHY_Physics', 'blender_MT','extern_bullet'])
                else:
                        env.Append (LIBS=['PHY_Ode',
                                        'PHY_Physics'])