X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=site_scons%2Fsenfutil.py;h=da24b19464c73b470af0e82a25e10bfe46849e34;hb=HEAD;hp=2b570d2e878cb826f1364641c710f6048a19c08f;hpb=8558757024b5e0181b62f888f665dc2dfc48639b;p=senf.git diff --git a/site_scons/senfutil.py b/site_scons/senfutil.py index 2b570d2..da24b19 100644 --- a/site_scons/senfutil.py +++ b/site_scons/senfutil.py @@ -1,4 +1,4 @@ -import os, os.path, site_tools.Yaptu, types, re, fnmatch +import os, os.path, site_tools.Yaptu, types, re, fnmatch, sys import SCons.Util from SCons.Script import * @@ -12,6 +12,19 @@ except NameError: BoolVariable = BoolOption ########################################################################### +extdir = os.path.join(senfutildir, '../senf/Ext') +sys.path.append(extdir) + +for ext in os.listdir(extdir): + if not os.path.isdir( os.path.join(extdir, ext)): continue + if ext.startswith('.'): continue + try: + setattr( sys.modules[__name__], ext, + __import__('%s.site_scons' % ext, fromlist=['senfutil']).senfutil ) + except ImportError: + pass + +########################################################################### def loadTools(env): global senfutildir @@ -27,8 +40,7 @@ def parseArguments(env, *defs): env.Help(""" Any construction environment variable may be set from the scons command line (see SConstruct file and SCons documentation for a list -of variables) usin -g +of variables) using VARNAME=value Assign new value VARNAME+=value Append value at end @@ -47,6 +59,8 @@ Special command line parameters: else: env.Replace(**{k: v}) env.Append(ARGUMENT_VARIABLES = {k:v}) + if env.get('PARSEFLAGS', None): + env.MergeFlags(env['PARSEFLAGS']) def importProcessEnv(env): env.Append( ENV = dict(( (k,v) @@ -154,8 +168,9 @@ def SetupForSENF(env, senf_path = [], flavor=None): CPPDEFINES = [ '$expandLogOption' ], CXXFLAGS = [ '-Wno-long-long', '-fno-strict-aliasing' ], LINKFLAGS = [ '-rdynamic' ], - LIBS = [ 'senf$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB', '$BOOSTIOSTREAMSLIB', - '$BOOSTSIGNALSLIB', '$BOOSTFSLIB' ], + LIBS = [ 'senf$LIBADDSUFFIX', 'rt', '$BOOSTREGEXLIB', + '$BOOSTSIGNALSLIB', '$BOOSTFSLIB', '$BOOSTSYSTEMLIB', + '$BOOSTDATETIMELIB' ], ) try: @@ -205,15 +220,21 @@ def DefaultOptions(env): env, BoolVariable('final', 'Build final (optimized) build', False), BoolVariable('debug', 'Link in debug symbols', False), + BoolVariable('profile', 'compile and link with the profiling enabled option', False), ) # Set nice default options env.Append( - CXXFLAGS = [ '-Wall', '-Woverloaded-virtual' ], - CXXFLAGS_final = [ '-O3' ], + CXXFLAGS_CLANG = [ '-Wno-unneeded-internal-declaration' ], # needed for BOOST_PARAMETER_KEYWORD + CXXFLAGS = [ '-Wall', '-Woverloaded-virtual', "${profile and '-pg' or None}", + '${str(CXX).split("/")[-1] == "clang++" and "$CXXFLAGS_CLANG" or None}' ], + CXXFLAGS_final = [ '-O3', '-fno-threadsafe-statics', '-fno-stack-protector', + "${profile and ' ' or '-ffunction-sections'}" ], CXXFLAGS_normal = [ '-O2', '-g' ], CXXFLAGS_debug = [ '-O0', '-g' ], + LINKFLAGS = [ "${profile and '-pg' or None}" ], + LINKFLAGS_final = [ "${profile and ' ' or '-Wl,--gc-sections'}" ], LINKFLAGS_normal = [ '-Wl,-S' ], LINKFLAGS_debug = [ '-g' ], )