Skip to content
Snippets Groups Projects
Commit 8c209f46 authored by g0dil's avatar g0dil
Browse files

Remove -ansi -pedantic from the g++ command for better optimization

Add support for 'EXTRA_DEFINES' and 'EXTRA_LIBS' config variables
Add additional config support for Boost and STLport (BOOST_RUNTIME, BOOST_DEBUG_RUNTIME and STLPORT_DEBUGLIB)
parent 270d60a6
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,8 @@ def InitOpts(): ...@@ -8,6 +8,8 @@ def InitOpts():
if opts is not None: return if opts is not None: return
opts = SCons.Options.Options('SConfig') opts = SCons.Options.Options('SConfig')
opts.Add('CXX', 'C++ compiler to use', 'g++') opts.Add('CXX', 'C++ compiler to use', 'g++')
opts.Add('EXTRA_DEFINES', 'Additional preprocessor defines', '')
opts.Add('EXTRA_LIBS', 'Additional libraries to link against', '')
opts.Add(SCons.Options.BoolOption('final','Enable optimization',0)) opts.Add(SCons.Options.BoolOption('final','Enable optimization',0))
def Finalizer(f): def Finalizer(f):
...@@ -20,6 +22,8 @@ def UseBoost(): ...@@ -20,6 +22,8 @@ def UseBoost():
opts.Add('BOOST_INCLUDES', 'Boost include directory', '') opts.Add('BOOST_INCLUDES', 'Boost include directory', '')
opts.Add('BOOST_VARIANT', 'The boost variant to use', '') opts.Add('BOOST_VARIANT', 'The boost variant to use', '')
opts.Add('BOOST_TOOLSET', 'The boost toolset to use', '') opts.Add('BOOST_TOOLSET', 'The boost toolset to use', '')
opts.Add('BOOST_RUNTIME', 'The boost runtime to use', '')
opts.Add('BOOST_DEBUG_RUNTIME', 'The boost debug runtime to use', '')
opts.Add('BOOST_LIBDIR', 'The directory of the boost libraries', '') opts.Add('BOOST_LIBDIR', 'The directory of the boost libraries', '')
Finalizer(FinalizeBoost) Finalizer(FinalizeBoost)
...@@ -28,7 +32,8 @@ def FinalizeBoost(env): ...@@ -28,7 +32,8 @@ def FinalizeBoost(env):
if env['BOOST_TOOLSET']: if env['BOOST_TOOLSET']:
runtime = "" runtime = ""
if not env['final'] : runtime += "gd" if env['final'] : runtime += env.get('BOOST_RUNTIME','')
else : runtime += env.get('BOOST_DEBUG_RUNTIME','gd')
if env['STLPORT_LIB'] : runtime += "p" if env['STLPORT_LIB'] : runtime += "p"
if runtime: runtime = "-" + runtime if runtime: runtime = "-" + runtime
env['BOOST_VARIANT'] = "-" + env['BOOST_TOOLSET'] + runtime env['BOOST_VARIANT'] = "-" + env['BOOST_TOOLSET'] + runtime
...@@ -43,13 +48,14 @@ def UseSTLPort(): ...@@ -43,13 +48,14 @@ def UseSTLPort():
InitOpts() InitOpts()
opts.Add('STLPORT_INCLUDES', 'STLport include directory', '') opts.Add('STLPORT_INCLUDES', 'STLport include directory', '')
opts.Add('STLPORT_LIB', 'Name of the stlport library or empty to not use stlport', '') opts.Add('STLPORT_LIB', 'Name of the stlport library or empty to not use stlport', '')
opts.Add('STLPORT_DEBUGLIB', 'Name of the stlport debug library','')
opts.Add('STLPORT_LIBDIR', 'The directory of the stlport libraries','') opts.Add('STLPORT_LIBDIR', 'The directory of the stlport libraries','')
Finalizer(FinalizeSTLPort) Finalizer(FinalizeSTLPort)
def FinalizeSTLPort(env): def FinalizeSTLPort(env):
env['STLPORT_DEBUGLIB'] = ''
if env['STLPORT_LIB']: if env['STLPORT_LIB']:
env['STLPORT_DEBUGLIB'] = env['STLPORT_LIB'] + '_stldebug' if not env['STLPORT_DEBUGLIB']:
env['STLPORT_DEBUGLIB'] = env['STLPORT_LIB'] + '_stldebug'
env.Append(LIBPATH = [ '$STLPORT_LIBDIR' ], env.Append(LIBPATH = [ '$STLPORT_LIBDIR' ],
CPPPATH = [ '$STLPORT_INCLUDES' ]) CPPPATH = [ '$STLPORT_INCLUDES' ])
if env['final']: if env['final']:
...@@ -79,8 +85,7 @@ def MakeEnvironment(): ...@@ -79,8 +85,7 @@ def MakeEnvironment():
for finalizer in finalizers: for finalizer in finalizers:
finalizer(env) finalizer(env)
env.Append(CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long', env.Append(CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long' ],
'-pedantic', '-ansi' ],
LOCALLIBDIR = [ '#' ], LOCALLIBDIR = [ '#' ],
LIBPATH = [ '$LOCALLIBDIR' ]) LIBPATH = [ '$LOCALLIBDIR' ])
...@@ -89,7 +94,10 @@ def MakeEnvironment(): ...@@ -89,7 +94,10 @@ def MakeEnvironment():
CPPDEFINES = [ 'NDEBUG' ]) CPPDEFINES = [ 'NDEBUG' ])
else: else:
env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ], env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ],
LINKFLAGS = [ '-g' ]) LINKFLAGS = [ '-g' ])
env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ],
LIBS = [ '$EXTRA_LIBS' ])
#return conf.Finish() #return conf.Finish()
return env return env
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment