From 08d330310fcda376fa44ac7c6264128841bc2394 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 3 Dec 2011 05:46:36 +0100 Subject: [PATCH] cleanup unnecessary builder function and flags in SCons build --- SConstruct | 11 +++++------ admin/scons/Buildhelper.py | 19 +++++-------------- admin/scons/LumieraEnvironment.py | 10 +++++----- tests/SConscript | 2 +- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/SConstruct b/SConstruct index 7abd1217b..4fbfa0b84 100644 --- a/SConstruct +++ b/SConstruct @@ -332,10 +332,10 @@ def defineBuildTargets(env, artifacts): We use a custom function to declare a whole tree of srcfiles. """ - lLib = env.SharedLibrary('lumiera', srcSubtree(env,'src/lib'), install=True) - lApp = env.SharedLibrary('lumieracommon', srcSubtree(env,'src/common'), install=True, LIBS=lLib) - lBack = env.SharedLibrary('lumierabackend', srcSubtree(env,'src/backend'),install=True) - lProc = env.SharedLibrary('lumieraproc', srcSubtree(env,'src/proc'), install=True) + lLib = env.SharedLibrary('lumiera', srcSubtree('src/lib'), install=True) + lApp = env.SharedLibrary('lumieracommon', srcSubtree('src/common'), install=True, LIBS=lLib) + lBack = env.SharedLibrary('lumierabackend', srcSubtree('src/backend'),install=True) + lProc = env.SharedLibrary('lumieraproc', srcSubtree('src/proc'), install=True) core = lLib+lApp+lBack+lProc @@ -363,8 +363,7 @@ def defineBuildTargets(env, artifacts): envGtk.mergeConf(['gtkmm-2.4','gthread-2.0','cairomm-1.0','gdl','xv','xext','sm']) envGtk.Append(LIBS=core) - objgui = srcSubtree(envGtk,'src/gui', appendCPP='LUMIERA_PLUGIN') - guimodule = envGtk.LumieraPlugin('gtk_gui', objgui, install=True) + guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('src/gui'), install=True) artifacts['gui'] = ( guimodule + [env.GuiResource(f) for f in env.Glob('src/gui/*.rc')] + artifacts['icons'] diff --git a/admin/scons/Buildhelper.py b/admin/scons/Buildhelper.py index e5d111885..990fa5921 100644 --- a/admin/scons/Buildhelper.py +++ b/admin/scons/Buildhelper.py @@ -49,20 +49,11 @@ def isHelpRequest(): -def srcSubtree(env,tree,isShared=True,builder=None,appendCPP=None, **args): - """ convenience wrapper: scans the given subtree, which is - relative to the current SConscript, find all source files and - declare them as Static or SharedObjects for compilation +def srcSubtree(tree, **args): + """ convenience wrapper: scan the given subtree, which is relative + to the current SConscript, and find all source files. """ - if appendCPP: env.Append(CPPDEFINES=appendCPP) - root = env.subst(tree) # expand Construction Vars - if not builder: - if isShared: - builder = lambda f: env.SharedObject(f, **args) - else: - builder = lambda f: env.Object(f, **args) - - return [builder(f) for f in scanSubtree(root)] + return list(scanSubtree(tree, **args)) @@ -161,7 +152,7 @@ def createPlugins(env, dir, **kw): @return: a list of build nodes defining a plugin for each of these source trees. """ return [env.LumieraPlugin( getDirname(tree) - , srcSubtree(env, tree, appendCPP='LUMIERA_PLUGIN') + , srcSubtree(tree) , **kw ) for tree in findSrcTrees(dir) diff --git a/admin/scons/LumieraEnvironment.py b/admin/scons/LumieraEnvironment.py index c0ce77375..1c314401b 100644 --- a/admin/scons/LumieraEnvironment.py +++ b/admin/scons/LumieraEnvironment.py @@ -205,8 +205,8 @@ def register_LumieraResourceBuilder(env): class WrappedStandardExeBuilder(SCons.Util.Proxy): """ Helper to add customisations and default configurations to SCons standard builders. The original builder object is wrapped and most calls are simply forwarded to this - wrapped object by Python magic. But some calls are intecepted in order to inject - suitalbe default configuration based on the project setup. + wrapped object by Python magic. But some calls are intercepted in order to inject + suitable default configuration based on the project setup. """ def __init__(self, originalBuilder): @@ -291,7 +291,7 @@ class LumieraModuleBuilder(WrappedStandardExeBuilder): explicit spec, falling back on the lib filename """ if 'soname' in kw: - soname = self.subst(kw['soname']) # explicitely defined by user + soname = self.subst(kw['soname']) # explicitly defined by user else: # else: use the library filename as DT_SONAME if SCons.Util.is_String(target): pathname = target.strip() @@ -331,7 +331,7 @@ class LumieraPluginBuilder(LumieraModuleBuilder): def register_LumieraCustomBuilders (lumiEnv): - """ install the customised builder versions tightly integrated with our buildsystem. + """ install the customised builder versions tightly integrated with our build system. Especially, these builders automatically add the build and installation locations and set the RPATH and SONAME in a way to allow a relocatable Lumiera directory structure """ @@ -362,7 +362,7 @@ def register_LumieraCustomBuilders (lumiEnv): action = Action(makeLink, "Install link: $TARGET -> "+srcSpec) env.Command (target,source, action) - # adding SymLink direclty as method on the environment object + # adding SymLink directly as method on the environment object # Probably that should better be a real builder, but I couldn't figure out # how to get the linktext through literally, which is necessary for relative links. # Judging from the sourcecode of SCons.Builder.BuilderBase, there seems to be no way diff --git a/tests/SConscript b/tests/SConscript index dd3584595..abbe86d35 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -29,7 +29,7 @@ def testExecutable(env,tree, exeName=None, obj=None): if obj: obj = [path.join(tree,name) for name in obj] else: - obj = srcSubtree(env,tree, isShared=False) # use all sourcefiles found in subtree + obj = srcSubtree(tree) # use all sourcefiles found in subtree if not exeName: exeName = 'test-%s' % tree return env.Program(exeName, obj + core)