From: g0dil Date: Wed, 26 Aug 2009 11:50:48 +0000 (+0000) Subject: Write _templates/SConscript sample file X-Git-Url: http://g0dil.de/git?p=senf.git;a=commitdiff_plain;h=213b5ea43eeaead3a9752b598069e6a1e99fe6e0 Write _templates/SConscript sample file Simplify auto builder macros in site_scons/SENFSCons.py git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1338 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/SConstruct b/SConstruct index 5ab04af..291a94e 100644 --- a/SConstruct +++ b/SConstruct @@ -22,6 +22,8 @@ env.Help(""" Additional top-level build targets: prepare Create all target files not part of the repository +default Build all default targets (like calling scons with no arguments) +examples Build all examples all_tests Build and run unit tests for all modules all_docs Build documentation for all modules all Build everything diff --git a/_templates/SConscript b/_templates/SConscript new file mode 100644 index 0000000..698b41c --- /dev/null +++ b/_templates/SConscript @@ -0,0 +1,30 @@ +# -*- python -*- + +Import('env') +import SENFSCons + +########################################################################### + +## Most modules will be built using the auto macros from site_scons/SENFSCons.py +## (see below). Arguments are: +## env - The construction environment +## name - name of target (AutoPacketBundle only) +## exclude - Files to exclude from the build +## subdirs - Subdirectories to recurse into +## doc_extra_sources - Extra source files (images) to build for the documentation +## +## If the macros don't do exactly what you want you may either copy the function definition +## body from site_scons/SENFSCons.py into the SConscript file or add additional targets + +## Build a standard library module +# +# SENFSCons.AutoRules(env, exclude=[...], subdirs=[...], doc_extra_sources=[...] + +## Build a packet bundle +# +# SENFSCons.AutoPacketBundle(env, name, exclude=[...], subdirs=[...], doc_extra_sources=[...] + +## Build an (additional) executable. Build it as default target (built when calling scons +## without arguments or with the 'default' argument +# +# env.Default(env.Program(name, [ sources...])) diff --git a/senf/Ext/SConscript b/senf/Ext/SConscript index 772dad7..ccfed8f 100644 --- a/senf/Ext/SConscript +++ b/senf/Ext/SConscript @@ -28,9 +28,9 @@ if sconscripts: \htmlonly
- {{ for name, title in EXTENSIONS: +{{ for name, title in EXTENSIONS:
${name}
${title}
- }} +}}
\endhtmlonly diff --git a/site_scons/SConscript.template b/site_scons/SConscript.template deleted file mode 100644 index 1914d2e..0000000 --- a/site_scons/SConscript.template +++ /dev/null @@ -1,10 +0,0 @@ -Import('env') -import SENFSCons - -########################################################################### - -SENFSCons.StandardTargets(env) - -# SENFSCons.Lib(env, -# library = 'Test', -# sources = SENFSCons.GlobSources()) diff --git a/site_scons/SENFSCons.py b/site_scons/SENFSCons.py index cc5e807..aed6649 100644 --- a/site_scons/SENFSCons.py +++ b/site_scons/SENFSCons.py @@ -100,23 +100,25 @@ def AllIncludesHH(env, exclude=[]): # parameters with their actual value. Parameters are marked with ((name)) ) def AutoRules(env, exclude=[], subdirs=[], doc_extra_sources = []): - import SENFSCons, glob, os.path + import SENFSCons - sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) ) - subscripts = glob.glob("*/SConscript") + sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) ) + subscripts = env.Glob("*/SConscript") + doxyfile = env.Glob("Doxyfile") - if sources : env.Append(ALLOBJECTS = env.Object(sources)) - if tests : env.BoostUnitTest('test', tests) - if includes : env.InstallSubdir('$INCLUDEINSTALLDIR', includes) - if os.path.exists("Doxyfile") : SENFSCons.Doxygen(env, extra_sources=((doc_extra_sources)) ) - if subscripts : SConscript(glob.glob("*/SConscript")) + if sources : env.Append(ALLOBJECTS = env.Object(sources)) + if tests : env.BoostUnitTest('test', tests) + if includes : env.InstallSubdir('$INCLUDEINSTALLDIR', includes) + if doxyfile : SENFSCons.Doxygen(env, extra_sources=((doc_extra_sources)) ) + if subscripts : SConscript(subscripts) def AutoPacketBundle(env, name, exclude=[], subdirs=[], doc_extra_sources=[]): - import SENFSCons, glob, os.path + import SENFSCons - sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) ) - subscripts = glob.glob("*/SConscript") + sources, tests, includes = SENFSCons.Glob(env, exclude=((exclude)), subdirs=((subdirs)) ) + subscripts = env.Glob("*/SConscript") + doxyfile = env.Glob("Doxyfile") objects = env.Object(sources) cobject = env.CombinedObject('${LOCALLIBDIR}/${NAME}${OBJADDSUFFIX}', objects, NAME=((name))) @@ -125,7 +127,7 @@ def AutoPacketBundle(env, name, exclude=[], subdirs=[], doc_extra_sources=[]): env.Append(ALLOBJECTS = objects, PACKET_BUNDLES = cobject) env.Install('$OBJINSTALLDIR', cobject) - if tests : env.BoostUnitTest('test', tests + cobject) - if includes : env.InstallSubdir('$INCLUDEINSTALLDIR', includes) - if os.path.exists("Doxyfile") : SENFSCons.Doxygen(env, extra_sources=((doc_extra_sources)) ) - if subscripts : SConscript(glob.glob("*/SConscript")) + if tests : env.BoostUnitTest('test', tests + cobject) + if includes : env.InstallSubdir('$INCLUDEINSTALLDIR', includes) + if doxyfile : SENFSCons.Doxygen(env, extra_sources=((doc_extra_sources)) ) + if subscripts : SConscript(subscripts)