From: g0dil Date: Wed, 9 Sep 2009 13:32:14 +0000 (+0000) Subject: Buildsystem updates X-Git-Url: http://g0dil.de/git?p=senf.git;a=commitdiff_plain;h=e7184facd970e81cf2c0de5e9688bb7b6b70a305 Buildsystem updates Implement SENFSCons.IndexPage to generate documentation index pages Minor doxygen build fixes Build Examples using sub-scons call's and remove obsolete SConscript's git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1406 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Examples/DVBAdapter/SConscript b/Examples/DVBAdapter/SConscript deleted file mode 100644 index c6b9285..0000000 --- a/Examples/DVBAdapter/SConscript +++ /dev/null @@ -1,15 +0,0 @@ -Import('env') -import SENFSCons - -import glob -import os.path - -########################################################################### - -#for f in glob.glob('*.cc'): -# bin = os.path.splitext(f)[0] -# -# SENFSCons.Binary(env, bin, f, -# LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ], -# OBJECTS = [ '#/Packets/DefaultBundle/DefaultBundle.o', -# '#/Packets/MPEGDVBBundle/MPEGDVBBundle.o' ]); diff --git a/Examples/MCSniffer/SConscript b/Examples/MCSniffer/SConscript deleted file mode 100644 index 1b89af3..0000000 --- a/Examples/MCSniffer/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -sources, tests, includes = SENFSCons.Glob(env) - -env.Alias('examples', env.Program('mcsniffer', sources + [ '${LOCALLIBDIR}/AllBundles.o' ])) diff --git a/Examples/MultiMCLoop/SConscript b/Examples/MultiMCLoop/SConscript deleted file mode 100644 index 7d5d5a6..0000000 --- a/Examples/MultiMCLoop/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -env.Alias('examples', env.Program('multimcloop', [ 'MultiMCLoop.cc' ])) diff --git a/Examples/RateStuffer/Doxyfile b/Examples/RateStuffer/Doxyfile index e4d44f5..6d262bd 100644 --- a/Examples/RateStuffer/Doxyfile +++ b/Examples/RateStuffer/Doxyfile @@ -4,3 +4,5 @@ SHOW_NAMESPACES = NO ALPHABETICAL_INDEX = NO PROJECT_NAME = Examples EXAMPLE_PATH = . + +# extra_source: env.Dia2Png('RateStuffer/ratestuffer.dia') \ No newline at end of file diff --git a/Examples/RateStuffer/SConscript b/Examples/RateStuffer/SConscript deleted file mode 100644 index dff9ebf..0000000 --- a/Examples/RateStuffer/SConscript +++ /dev/null @@ -1,14 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -sources, tests, includes = SENFSCons.Glob(env) - -env.Alias('examples', env.Program('ratestuffer', sources)) - -SENFSCons.Doxygen(env, extra_sources=[ - env.Dia2Png('ratestuffer.dia') -]) diff --git a/Examples/SConscript b/Examples/SConscript index c5e6c01..60c1337 100644 --- a/Examples/SConscript +++ b/Examples/SConscript @@ -1,37 +1,24 @@ # -*- python -*- Import('env') -import SENFSCons, glob, yaptu +import SENFSCons, glob ########################################################################### -EXAMPLES = [] -for dox in sorted(glob.glob("*/Mainpage.dox")): - title = ([None] + [ line.split('\\mainpage',1)[-1].strip() for line in file(dox) - if '\\mainpage' in line ])[-1] - if title: - EXAMPLES.append( (dox.split('/',1)[0], title) ) +SENFSCons.IndexPage(env, 'Mainpage.dox', title="Examples") -MAINPAGE=""" -/** \mainpage Examples - - \htmlonly -
- -{{ for name, title in EXAMPLES: -
${name}
${title}
-}} - -
- \endhtmlonly - */ -""" - -file("Mainpage.dox","w").write(yaptu.process(MAINPAGE, globals(), env.Dictionary())) +SENFSCons.Doxygen(env) -SConscript(glob.glob("*/SConscript")) +for sconstruct in glob.glob("*/SConstruct"): + dir=env.File(sconstruct).dir + example=env.Command(dir.File('.example.phony'), env.Alias('default'), + [ '$SCONS -C $EXAMPLEDIR' ], + CONCURRENCY_LEVEL=1, EXAMPLEDIR=dir) + env.Alias('examples', example) -env.Clean('all','Mainpage.dox') -env.Clean('all_docs','Mainpage.dox') -SENFSCons.Doxygen(env) +for dox in glob.glob("*/Doxyfile"): + extra_sources = [ eval(line.split(':',1)[1]) + for line in file(dox) + if line.startswith("# extra_source: ") ] + SENFSCons.Doxygen(env, doxyfile=dox, extra_sources=extra_sources) diff --git a/Examples/Sniffer/SConscript b/Examples/Sniffer/SConscript deleted file mode 100644 index 458ed89..0000000 --- a/Examples/Sniffer/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -sources, tests, includes = SENFSCons.Glob(env) - -env.Alias('examples', env.Program('sniffer', sources + [ '${LOCALLIBDIR}/AllBundles.o' ])) -SENFSCons.Doxygen(env) diff --git a/Examples/TCPClientServer/SConscript b/Examples/TCPClientServer/SConscript deleted file mode 100644 index 136a95c..0000000 --- a/Examples/TCPClientServer/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -env.Alias('examples', env.Program('client', 'client.cc')) -env.Alias('examples', env.Program('server', 'server.cc')) diff --git a/Examples/UDPClientServer/SConscript b/Examples/UDPClientServer/SConscript deleted file mode 100644 index ca4c4e8..0000000 --- a/Examples/UDPClientServer/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -# -*- python -*- - -Import('env') -import SENFSCons - -########################################################################### - -env.Alias('examples', env.Program('udpClient', 'udpClient.cc')) -env.Alias('examples', env.Program('udpServer', 'udpServer.cc')) - -SENFSCons.Doxygen(env) diff --git a/Examples/psi2tsModule/SConscript b/Examples/psi2tsModule/SConscript deleted file mode 100644 index 81e0574..0000000 --- a/Examples/psi2tsModule/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -Import('env') -import SENFSCons, glob - -########################################################################### - -#sources = SENFSCons.GlobSources() - -#SENFSCons.StandardTargets(env) - -#SENFSCons.Object(env, -# target = 'psi2ts.o', -# sources = sources, -# LIBS = ['senf']) diff --git a/HowTos/SConscript b/HowTos/SConscript index 4ff973a..2b70a1b 100644 --- a/HowTos/SConscript +++ b/HowTos/SConscript @@ -5,29 +5,7 @@ import SENFSCons, glob, yaptu ########################################################################### -HOWTOS = [] -for dox in sorted(glob.glob("*/Mainpage.dox")): - title = ([None] + [ line.split('\\mainpage',1)[-1].strip() for line in file(dox) - if '\\mainpage' in line ])[-1] - if title: - HOWTOS.append( (dox.split('/',1)[0], title) ) - -MAINPAGE=""" -/** \mainpage HowTo's - - \htmlonly -
- -{{ for name, title in HOWTOS: -
${name}
${title}
-}} - -
- \endhtmlonly - */ -""" - -file("Mainpage.dox","w").write(yaptu.process(MAINPAGE, globals(), env.Dictionary())) +SENFSCons.IndexPage(env, 'Mainpage.dox', title="HowTo's") SConscript(glob.glob("*/SConscript")) diff --git a/senf/Ext/SConscript b/senf/Ext/SConscript index ccfed8f..1a6d41f 100644 --- a/senf/Ext/SConscript +++ b/senf/Ext/SConscript @@ -8,36 +8,9 @@ import SENFSCons, glob, os.path, yaptu sconscripts = sorted(glob.glob("*/SConscript")) if sconscripts: - EXTENSIONS = [] - for script in sconscripts: - name = os.path.split(script)[0] - dox = os.path.join(name, 'Mainpage.dox') - title = '' - if os.path.exists(dox): - title = ([''] + [ line.split('\\mainpage',1)[-1].strip() for line in file(dox) - if '\\mainpage' in line ])[-1] - EXTENSIONS.append((name, title)) - - - MAINPAGE=""" - /** \mainpage Extensions - - This folder contains additional SENF extensions which are built - into the senf libarary but are not part of senf proper. - - \htmlonly -
- -{{ for name, title in EXTENSIONS: -
${name}
${title}
-}} - -
- \endhtmlonly - */ - """ - - file("Mainpage.dox","w").write(yaptu.process(MAINPAGE, globals(), env.Dictionary())) + SENFSCons.IndexPage(env, 'Mainpage.dox', title="Extensions", + text="""This folder contains additional SENF extensions which are built + into the senf libarary but are not part of senf proper.""") SConscript(sconscripts) diff --git a/site_scons/SENFSCons.py b/site_scons/SENFSCons.py index 9d05e9f..7ff6272 100644 --- a/site_scons/SENFSCons.py +++ b/site_scons/SENFSCons.py @@ -1,4 +1,4 @@ -import os.path, glob +import os.path, glob, yaptu import SCons.Options, SCons.Environment, SCons.Script.SConscript, SCons.Node.FS import SCons.Defaults, SCons.Action from SCons.Script import * @@ -44,7 +44,9 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = [], output_directory = " denv.update(kw) return { 'DOXYENV' : denv, 'MODULE' : module, - 'OUTPUT_DIRECTORY': output_directory }; + 'OUTPUT_DIRECTORY': output_directory, + 'DOXYGENCOM' : "site_scons/lib/doxygen.sh $DOXYOPTS $SOURCE", + }; opts = [ '--tagfile-name', '"${MODULE}.tag"', '--output-dir', '$OUTPUT_DIRECTORY' ] @@ -52,7 +54,7 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = [], output_directory = " # (need to exclude the 'clean' case, otherwise we'll have duplicate nodes) if not env.GetOption('clean'): tagfile = env.Doxygen(doxyfile, DOXYOPTS = opts + [ '--tagfile' ], - **vars(generate_tagfile='doc/${MODULE}.tag')) + **vars(generate_tagfile='${OUTPUT_DIRECTORY}/${MODULE}.tag')) env.Append(ALL_TAGFILES = [ tagfile[0].abspath ]) env.Depends(tagfile, [ env.File('#/site_scons/lib/doxygen.sh'), env.File('#/site_scons/lib/tag-munge.xsl') ]) @@ -95,6 +97,37 @@ def AllIncludesHH(env, exclude=[]): for f in headers ])) env.Clean(env.Alias('all'), target) + +INDEXPAGE=""" +/** \mainpage ${TITLE} + + ${TEXT} + + \htmlonly +
+ +{{ for name, title in SUBPAGES: +
${name}
${title}
+}} + +
+ \endhtmlonly + */ +""" + +def IndexPage(env, name, title, text=""): + SUBPAGES = [] + for dox in sorted(glob.glob("*/Mainpage.dox")): + subtitle = ([None] + [ line.split('\\mainpage',1)[-1].strip() for line in file(dox) + if '\\mainpage' in line ])[-1] + if subtitle: + SUBPAGES.append( (dox.split('/',1)[0], subtitle) ) + file(name,"w").write(yaptu.process( + INDEXPAGE, globals(), { 'TITLE': title, 'TEXT': text, 'SUBPAGES': SUBPAGES })) + env.Clean('all',name) + env.Clean('all_docs',name) + + ########################################################################### # The following functions serve as simple macros for most SConscript files # diff --git a/site_scons/lib/doxygen.sh b/site_scons/lib/doxygen.sh index dd72609..90abf08 100755 --- a/site_scons/lib/doxygen.sh +++ b/site_scons/lib/doxygen.sh @@ -139,13 +139,16 @@ doxydir="`abspath "$doxydir"`" #`" ## Find $TOPDIR -cd "$doxydir" -while [ ! -r "SConstruct" -a "`pwd`" != "/" ]; do cd ..; done -if [ ! -r "SConstruct" ]; then - echo "topdir not found" - exit 1; +if [ -z "$TOPDIR" ]; then + cd "$doxydir" + while [ ! -r "SConstruct" -a "`pwd`" != "/" ]; do cd ..; done + if [ ! -r "SConstruct" ]; then + echo "topdir not found" + exit 1; + fi + TOPDIR="`pwd`"; fi -TOPDIR="`pwd`"; + reltopdir="`relpath "$doxydir/$output_dir/$html_dir" "$TOPDIR"`" #`" cd "$doxydir" @@ -162,6 +165,15 @@ if [ -n "$tagfile_name" ]; then done fi +## Remove empty tagfiles from list of tagfiles + +x="$tagfiles"; tagfiles="" +for f in $x; do + if [ -s "$f" ]; then + tagfiles="$tagfiles${tagfiles:+ }$f" + fi +done + ## Call doxygen proper generate_tagfile="" @@ -170,6 +182,7 @@ if [ "$tagfile" = "YES" ]; then fi export TOPDIR LIBDIR html tagfile tagfile_name tagfiles output_dir html_dir generate_tagfile +echo "+ cd $doxydir" cmd ${DOXYGEN:-doxygen} diff --git a/site_scons/site_tools/Doxygen.py b/site_scons/site_tools/Doxygen.py index cd8c39b..a6cf523 100644 --- a/site_scons/site_tools/Doxygen.py +++ b/site_scons/site_tools/Doxygen.py @@ -367,7 +367,7 @@ def doxyAction(target, source, env): SCons.Action.Action("$DOXYGENCOM")(target, source, env.Clone(ENV = e), show=False) def doxyActionStr(target, source, env): - return env.subst("$DOXYGENCOM") + return env.subst("$DOXYGENCOM",target=target,source=source) def generate(env): """