X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=satscons%2FSatSCons.py;h=6c8bcc90093deff004d9c6ca9fa7a615753cb5cd;hb=05633cf2fb569dad4bf2118ec5203e61974b35f5;hp=12eb6cfa9632e08e1854bda892ab09d4f99e106e;hpb=c52cd7d87dbb525c1267aad27391b8b7365dbb57;p=senf.git diff --git a/satscons/SatSCons.py b/satscons/SatSCons.py index 12eb6cf..6c8bcc9 100644 --- a/satscons/SatSCons.py +++ b/satscons/SatSCons.py @@ -1,13 +1,22 @@ import os.path, SCons.Options, SCons.Environment, SCons.Script.SConscript, glob +SCONS_TOOLS = [ + "Doxygen", + "Dia2Png", +] + opts = None finalizers = [] +basedir = os.path.split(__file__)[0] + def InitOpts(): global opts if opts is not None: return opts = SCons.Options.Options('SConfig') 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)) def Finalizer(f): @@ -20,15 +29,18 @@ def UseBoost(): opts.Add('BOOST_INCLUDES', 'Boost include directory', '') opts.Add('BOOST_VARIANT', 'The boost variant 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', '') Finalizer(FinalizeBoost) def FinalizeBoost(env): - env.Tool('BoostUnitTests', [os.path.split(__file__)[0]]) + env.Tool('BoostUnitTests', [basedir]) if env['BOOST_TOOLSET']: 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 runtime: runtime = "-" + runtime env['BOOST_VARIANT'] = "-" + env['BOOST_TOOLSET'] + runtime @@ -43,13 +55,14 @@ def UseSTLPort(): InitOpts() 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_DEBUGLIB', 'Name of the stlport debug library','') opts.Add('STLPORT_LIBDIR', 'The directory of the stlport libraries','') Finalizer(FinalizeSTLPort) def FinalizeSTLPort(env): - env['STLPORT_DEBUGLIB'] = '' 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' ], CPPPATH = [ '$STLPORT_INCLUDES' ]) if env['final']: @@ -58,12 +71,6 @@ def FinalizeSTLPort(env): env.Append(LIBS = [ '$STLPORT_DEBUGLIB' ], CPPDEFINES = [ '_STLP_DEBUG' ]) -def UseDoxygen(): - Finalizer(FinalizeDoxygen) - -def FinalizeDoxygen(env): - env.Tool('Doxygen', [os.path.split(__file__)[0]]) - def MakeEnvironment(): global opts, finalizers InitOpts() @@ -79,8 +86,10 @@ def MakeEnvironment(): for finalizer in finalizers: finalizer(env) - env.Append(CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long', - '-pedantic', '-ansi' ], + for tool in SCONS_TOOLS: + env.Tool(tool, [basedir]) + + env.Append(CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', '-Wno-long-long' ], LOCALLIBDIR = [ '#' ], LIBPATH = [ '$LOCALLIBDIR' ]) @@ -89,14 +98,17 @@ def MakeEnvironment(): CPPDEFINES = [ 'NDEBUG' ]) else: env.Append(CXXFLAGS = [ '-O0', '-g', '-fno-inline' ], - LINKFLAGS = [ '-g' ]) + LINKFLAGS = [ '-g' ]) + + env.Append(CPPDEFINES = [ '$EXTRA_DEFINES' ], + LIBS = [ '$EXTRA_LIBS' ]) #return conf.Finish() return env -def GlobSources(): +def GlobSources(exclude=[]): testSources = glob.glob("*.test.cc") - sources = [ x for x in glob.glob("*.cc") if x not in testSources ] + sources = [ x for x in glob.glob("*.cc") if x not in testSources and x not in exclude ] return (sources, testSources) def StandardTargets(env): @@ -126,7 +138,7 @@ def Objects(env, sources, testSources = None, LIBS = []): if testSources: test = env.BoostUnitTests( - target = 'test.log', + target = 'test', source = sources, test_source = testSources, LIBS = LIBS, @@ -139,17 +151,18 @@ def Objects(env, sources, testSources = None, LIBS = []): return objects -def Doxygen(env, sources, testSources = None): - if type(sources) == type(()): - testSources = sources[1] - sources = sources[0] - - doc = env.Doxygen( - target = 'doc', - source = sources ) - - env.Alias('all_docs', doc) - return doc +def DoxyGlob(exclude=[]): + sources = [ f + for ext in ("cci", "ct", "cti", "h", "hh", "ih", "mmc", "dox") + for f in glob.glob("*."+ext) + if f not in exclude ] + return sources + +def Doxygen(env, doxyfile="Doxyfile", extra_sources = []): + docs = env.Doxygen(doxyfile) + env.Depends(docs,extra_sources) + env.Alias('all_docs', *docs) + return docs def Lib(env, library, sources, testSources = None, LIBS = []): objects = Objects(env,sources,testSources,LIBS=LIBS)