From 3f5115064aea902b3f6886dc688e7a20d771a212 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 1 Sep 2009 23:32:34 +0000 Subject: == SCons == * Add BGE_CXXFLAGS so we can get rid of hard-coded BGE compiler settings. This was only done for windows, but now linuxers and osxers should be able to set BGE-specific optimisation too. See the windows default configs for example. --- config/win32-vc-config.py | 1 + config/win64-vc-config.py | 1 + source/gameengine/BlenderRoutines/SConscript | 8 +------- source/gameengine/Converter/SConscript | 2 +- source/gameengine/Expressions/SConscript | 8 +------- source/gameengine/GameLogic/SConscript | 6 +----- source/gameengine/GamePlayer/common/SConscript | 8 +------- source/gameengine/GamePlayer/ghost/SConscript | 12 +++--------- source/gameengine/Ketsji/KXNetwork/SConscript | 9 +-------- source/gameengine/Ketsji/SConscript | 6 +----- source/gameengine/Physics/Bullet/SConscript | 8 +------- source/gameengine/Physics/common/SConscript | 8 +------- source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript | 8 +------- source/gameengine/Rasterizer/SConscript | 8 +------- source/gameengine/SceneGraph/SConscript | 8 +------- source/gameengine/VideoTexture/SConscript | 7 +------ tools/btools.py | 2 ++ 17 files changed, 20 insertions(+), 90 deletions(-) diff --git a/config/win32-vc-config.py b/config/win32-vc-config.py index c50f41b6d4b..5c4342d4f30 100644 --- a/config/win32-vc-config.py +++ b/config/win32-vc-config.py @@ -149,6 +149,7 @@ CXX = 'cl.exe' CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267'] CXXFLAGS = ['/EHsc'] +BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] diff --git a/config/win64-vc-config.py b/config/win64-vc-config.py index ed08e578df8..abc90c84f33 100644 --- a/config/win64-vc-config.py +++ b/config/win64-vc-config.py @@ -163,6 +163,7 @@ CXX = 'cl.exe' CFLAGS = [] CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/wd4244', '/wd4305', '/wd4800', '/wd4065', '/wd4267'] CXXFLAGS = ['/EHsc'] +BGE_CXXFLAGS = ['/O2', '/EHsc', '/GR', '/fp:fast'] BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr'] diff --git a/source/gameengine/BlenderRoutines/SConscript b/source/gameengine/BlenderRoutines/SConscript index eb5f2a76e10..dc5a93a2e48 100644 --- a/source/gameengine/BlenderRoutines/SConscript +++ b/source/gameengine/BlenderRoutines/SConscript @@ -28,10 +28,4 @@ incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_OPENGL_INC'] -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc','win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_bloutines', sources, Split(incs), defs, libtype=['core', 'player'], priority=[300, 45] , cxx_compileflags=cxxflags) +env.BlenderLib ( 'bf_bloutines', sources, Split(incs), defs, libtype=['core', 'player'], priority=[300, 45] , cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript index 7d3185605d5..9164a9f6d78 100644 --- a/source/gameengine/Converter/SConscript +++ b/source/gameengine/Converter/SConscript @@ -23,4 +23,4 @@ incs += ' #source/blender/makesrna' incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_BULLET_INC'] -env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,50] ) +env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,50], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Expressions/SConscript b/source/gameengine/Expressions/SConscript index 69f87ffbb90..dc9c184fd8a 100644 --- a/source/gameengine/Expressions/SConscript +++ b/source/gameengine/Expressions/SConscript @@ -6,10 +6,4 @@ sources = env.Glob('*.cpp') incs ='. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/SceneGraph #source/blender/blenloader' incs += ' ' + env['BF_PYTHON_INC'] -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_expressions', sources, Split(incs), [], libtype=['core','player'], priority = [360,120], cxx_compileflags=cxxflags) +env.BlenderLib ( 'bf_expressions', sources, Split(incs), [], libtype=['core','player'], priority = [360,120], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index 837769e5e78..f259a338dc0 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -17,12 +17,8 @@ if env['WITH_BF_SDL']: else: defs.append('DISABLE_SDL') -cxxflags = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') if env['BF_DEBUG']: defs.append('_DEBUG') -env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330, 100], cxx_compileflags=cxxflags ) +env.BlenderLib ( 'bf_logic', sources, Split(incs), defs, libtype=['core','player'], priority=[330, 100], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript index 1942cde2531..3ac2576b46d 100644 --- a/source/gameengine/GamePlayer/common/SConscript +++ b/source/gameengine/GamePlayer/common/SConscript @@ -62,10 +62,4 @@ incs += Split(env['BF_PYTHON_INC']) incs += Split(env['BF_PNG_INC']) incs += Split(env['BF_ZLIB_INC']) -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = [], libtype='player', priority=5, cxx_compileflags=cxxflags) +env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = [], libtype='player', priority=5, cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 83bc61381c0..ce8b07b9393 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -42,14 +42,8 @@ incs = ['.', incs += Split(env['BF_PYTHON_INC']) -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -defs = '' +defs = [] if env['WITH_BF_FFMPEG']: - defs += ' WITH_FFMPEG' + defs.append('WITH_FFMPEG') -env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = Split(defs), libtype='player',priority=5, cxx_compileflags=cxxflags) +env.BlenderLib (libname='gp_ghost', sources=source_files, includes = incs, defines = defs, libtype='player',priority=5, cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/KXNetwork/SConscript b/source/gameengine/Ketsji/KXNetwork/SConscript index e6584b55ed2..ce4a29b9492 100644 --- a/source/gameengine/Ketsji/KXNetwork/SConscript +++ b/source/gameengine/Ketsji/KXNetwork/SConscript @@ -9,11 +9,4 @@ incs += ' #source/gameengine/Network #source/gameengine/SceneGraph' incs += ' ' + env['BF_PYTHON_INC'] -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - - -env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['core', 'player'], priority=[400, 145], cxx_compileflags=cxxflags ) +env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['core', 'player'], priority=[400, 145], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index d3b67cfdb11..ea9d32fa0bf 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -29,12 +29,8 @@ if env['WITH_BF_SDL']: else: defs.append('DISABLE_SDL') -cxxflags = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') if env['BF_DEBUG']: defs.append('_DEBUG') # for Python -env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320, 60], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_ketsji', sources, Split(incs), defs, libtype=['core','player'], priority=[320, 60], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/Bullet/SConscript b/source/gameengine/Physics/Bullet/SConscript index 44b75402630..0b797c2cb8b 100644 --- a/source/gameengine/Physics/Bullet/SConscript +++ b/source/gameengine/Physics/Bullet/SConscript @@ -21,10 +21,4 @@ incs += ' #intern/guardedalloc' incs += ' ' + env['BF_BULLET_INC'] incs += ' ' + env['BF_PYTHON_INC'] -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,80], cxx_compileflags=cxxflags ) +env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,80], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Physics/common/SConscript b/source/gameengine/Physics/common/SConscript index 447b0ec1bbb..8b373ec830c 100644 --- a/source/gameengine/Physics/common/SConscript +++ b/source/gameengine/Physics/common/SConscript @@ -5,10 +5,4 @@ sources = 'PHY_IMotionState.cpp PHY_IController.cpp PHY_IPhysicsController.cpp P incs = '. ../Dummy #intern/moto/include' -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360, 90], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_common', Split(sources), Split(incs), [], libtype=['core','player'], priority=[360, 90], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript index e206c90ea25..963c6616b64 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript @@ -8,10 +8,4 @@ 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' -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350, 115], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_oglrasterizer', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350, 115], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/Rasterizer/SConscript b/source/gameengine/Rasterizer/SConscript index 255131f9a44..c2af14e8ce5 100644 --- a/source/gameengine/Rasterizer/SConscript +++ b/source/gameengine/Rasterizer/SConscript @@ -7,10 +7,4 @@ sources = env.Glob('*.cpp') incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/BlenderRoutines #extern/glew/include #source/gameengine/Expressions #source/gameengine/SceneGraph #source/blender/blenkernel #source/blender/makesdna' incs += ' ' + env['BF_PYTHON_INC'] -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['core','player'], priority=[350,115], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['core','player'], priority=[350,115], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/SceneGraph/SConscript b/source/gameengine/SceneGraph/SConscript index b3db50117f1..8f433a21e49 100644 --- a/source/gameengine/SceneGraph/SConscript +++ b/source/gameengine/SceneGraph/SConscript @@ -6,10 +6,4 @@ sources = env.Glob('*.cpp') incs = '. #intern/moto/include' -cxxflags = [] -if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') - -env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,125], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_scenegraph', sources, Split(incs), [], libtype=['core','player'], priority=[325,125], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript index d6b78f6d1a6..583ccf29dbd 100644 --- a/source/gameengine/VideoTexture/SConscript +++ b/source/gameengine/VideoTexture/SConscript @@ -15,15 +15,10 @@ incs += ' #source/blender/gpu #source/kernel/gen_system #intern/string #intern/m incs += ' #intern/guardedalloc #extern/glew/include' defs = [] -cxxflags = [] if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - cxxflags.append ('/GR') - cxxflags.append ('/O2') - cxxflags.append ('/EHsc') if env['BF_DEBUG']: defs.append('_DEBUG') - incs += ' ' + env['BF_PYTHON_INC'] #incs += ' ' + env['BF_OPENGL_INC'] @@ -32,4 +27,4 @@ if env['WITH_BF_FFMPEG']: incs += ' ' + env['BF_FFMPEG_INC'] + ' ' + env['BF_PTHREADS_INC'] defs.append('__STDC_CONSTANT_MACROS') -env.BlenderLib ( 'bf_videotex', sources, Split(incs), defs, libtype=['core','player'], priority=[300, 72], cxx_compileflags = cxxflags ) +env.BlenderLib ( 'bf_videotex', sources, Split(incs), defs, libtype=['core','player'], priority=[300, 72], cxx_compileflags=env['BGE_CXXFLAGS']) diff --git a/tools/btools.py b/tools/btools.py index 1ae952adbc7..580a457e3a0 100755 --- a/tools/btools.py +++ b/tools/btools.py @@ -77,6 +77,7 @@ def validate_arguments(args, bc): 'BF_OPENGL_LINKFLAGS', 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS', + 'BGE_CXXFLAGS', 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS', 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS', 'C_WARN', 'CC_WARN', 'CXX_WARN', @@ -333,6 +334,7 @@ def read_opts(cfg, args): ('CFLAGS', 'C only flags', ''), ('CCFLAGS', 'Generic C and C++ flags', ''), ('CXXFLAGS', 'C++ only flags', ''), + ('BGE_CXXFLAGS', 'C++ only flags for BGE', ''), ('CPPFLAGS', 'Defines', ''), ('REL_CFLAGS', 'C only release flags', ''), ('REL_CCFLAGS', 'Generic C and C++ release flags', ''), -- cgit v1.2.3