Enable CXX_GUARDEDALLOC support through SCons.
authorNathan Letwory <nathan@letworyinteractive.com>
Fri, 8 Oct 2010 20:39:56 +0000 (20:39 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Fri, 8 Oct 2010 20:39:56 +0000 (20:39 +0000)
15 files changed:
build_files/scons/tools/btools.py
intern/guardedalloc/SConscript
intern/string/SConscript
source/gameengine/BlenderRoutines/SConscript
source/gameengine/Converter/SConscript
source/gameengine/Expressions/SConscript
source/gameengine/GameLogic/SConscript
source/gameengine/Ketsji/SConscript
source/gameengine/Network/SConscript
source/gameengine/Physics/Bullet/SConscript
source/gameengine/Physics/Dummy/SConscript
source/gameengine/Physics/common/SConscript
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
source/gameengine/Rasterizer/SConscript
source/gameengine/SceneGraph/SConscript

index 37d9048d70d44a1fedb66de2fd2ff58589f82439..737ce40d702142b7edadad158f21ea5729660b3c 100644 (file)
@@ -92,6 +92,7 @@ def validate_arguments(args, bc):
             'WITH_BF_RAYOPTIMIZATION',
             'BF_RAYOPTIMIZATION_SSE_FLAGS',
             'BF_NO_ELBEEM',
+           'WITH_BF_CXX_GUARDEDALLOC',
             'BF_VCREDIST' # Windows-only, and useful only when creating installer
             ]
     
@@ -453,6 +454,7 @@ def read_opts(env, cfg, args):
         
         (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)),
         ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''),
+        (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)),
         ('BF_VCREDIST', 'Full path to vcredist', '')
     ) # end of opts.AddOptions()
 
index 0c9c7d136080ac57df574e94c733578e875e99c3..74d6e07269f24732c85fe56d57b07123ccfd06c5 100644 (file)
@@ -2,7 +2,14 @@
 
 Import('env')
 
-sources = env.Glob('intern/*.c')
+defs = []
+
+sources = ['intern/mallocn.c', 'intern/mmap_win.c']
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    sources.append('cpp/mallocn.cpp')
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 incs = '.'
 
-env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] )
+env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defs, libtype=['intern','player'], priority = [5,150] )
index f8342bf12c2679a9e803a0eb3ea7ebfcc18c5d15..dac0ead8e6107346f63971dd73686309d30eaf4a 100644 (file)
@@ -4,4 +4,10 @@ Import ('env')
 sources = env.Glob('intern/*.cpp')
 incs = '.'
 
-env.BlenderLib ('bf_intern_string', sources, Split(incs), [], libtype=['intern','player'], priority = [50,10] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #intern/guardedalloc'
+
+env.BlenderLib ('bf_intern_string', sources, Split(incs), defs, libtype=['intern','player'], priority = [50,10] )
index f53fc509c6d841527ec19bbfbf1c73a9712f113a..1a774fc8aba70fed43024ae3bee25e1082d3fac1 100644 (file)
@@ -30,6 +30,9 @@ if env['WITH_BF_PYTHON']:
 else:
     defs.append('DISABLE_PYTHON')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 incs += ' ' + env['BF_BULLET_INC']
 incs += ' ' + env['BF_OPENGL_INC']
 
index ab1d7574d89ecf6294d0ddb22a1978556db8a7fe..7701d27730b1f26b2b06a6744ea44b4e5a210c17 100644 (file)
@@ -32,4 +32,7 @@ if env['WITH_BF_PYTHON']:
 else:
     defs.append('DISABLE_PYTHON')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
index 007d6373c7776fddb17b4f02e94382e91ce018e8..85db689a9baf2bb15eefd13847d0d85500a723d0 100644 (file)
@@ -12,4 +12,7 @@ if env['WITH_BF_PYTHON']:
 else:
     defs.append('DISABLE_PYTHON')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
index 507bb7f0bddf5e3fc3764ef74fe91ca021e44c37..c9d1fed875d628baa2c38775b6273eec67d4fd93 100644 (file)
@@ -23,4 +23,8 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     if env['BF_DEBUG']:
         defs.append('_DEBUG')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #/intern/guardedalloc'
+
 env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330,65], cxx_compileflags=env['BGE_CXXFLAGS'])
index 8d54452be0daf1b9ac1280602c0d798b3d8cca26..49e4528594f33b52be76e67f83616fdbced636d9 100644 (file)
@@ -40,4 +40,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
     if env['BF_DEBUG']:
         defs.append('_DEBUG') # for Python
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320,45], cxx_compileflags=env['BGE_CXXFLAGS'])
index 3883dc71c9cabe4d99f3fab49a549cfa132b4be2..3cf1747d013b9ee2215a6115c73bbd024163cf66 100644 (file)
@@ -5,4 +5,10 @@ sources = env.Glob('*.cpp') #'NG_NetworkMessage.cpp NG_NetworkObject.cpp NG_Netw
 
 incs = '. #source/kernel/gen_system #intern/string #intern/moto/include'
 
-env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), [], libtype=['core','player'], priority=[400,130] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_ngnetwork', sources, Split(incs), defs, libtype=['core','player'], priority=[400,130] )
index f58085ab3543d2325029843c120aa63c781ec0b1..6beb044671c73de1303b8ce865be940e62ed0306 100644 (file)
@@ -27,4 +27,7 @@ if env['WITH_BF_PYTHON']:
 else:
     defs.append('DISABLE_PYTHON')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
index dc76e8046a0078c8fbc5c93710164469507abdb0..496092133c3056acc452f04345e8817df04af478 100644 (file)
@@ -5,4 +5,10 @@ sources = 'DummyPhysicsEnvironment.cpp'
 
 incs = '. ../common'
 
-env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,60] )
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_dummy', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,60] )
index 719c028ee8f3686c8168655bc16d1d098346f1d5..38bb7a1130925f2adac12cb3032681d740749fbe 100644 (file)
@@ -5,4 +5,10 @@ sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp P
 
 incs = '. ../Dummy #intern/moto/include'
 
-env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_physics_common', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[360,55], cxx_compileflags=env['BGE_CXXFLAGS'])
index 68e6789c05e2c737d9e5d7b2f4f2704cc36daab1..8ad6a8b28a2044bafc3e7dc3d27d80fda64ec985 100644 (file)
@@ -10,4 +10,7 @@ incs += ' #source/blender/gpu #extern/glew/include ' + env['BF_OPENGL_INC']
 incs += ' #source/blender/gameengine/Ketsji #source/gameengine/SceneGraph #source/blender/makesdna #source/blender/blenkernel'
 incs += ' #intern/guardedalloc #source/blender/blenlib'
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), defines = defs, libtype=['core','player'], priority=[350,75], cxx_compileflags=env['BGE_CXXFLAGS'])
index a78a0289d98f6efdf7c206ef72522b619a685bcc..dc189c54a407dbe3f0e1ce7330ad85e7e2e3586d 100644 (file)
@@ -13,4 +13,7 @@ if env['WITH_BF_PYTHON']:
 else:
     defs.append('DISABLE_PYTHON')
 
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+
 env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
index 2a33cd67b5e45b54d9d941d1d0a35a323b2426c6..992a10befa2958600c48d9c70c5378cde5891a0b 100644 (file)
@@ -6,4 +6,10 @@ sources = env.Glob('*.cpp')
 
 incs = '. #intern/moto/include'
 
-env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+    defs.append('WITH_CXX_GUARDEDALLOC')
+    incs += ' #intern/guardedalloc'
+
+env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), defs, libtype=['core','player'], priority=[325,85], cxx_compileflags=env['BGE_CXXFLAGS'])