From: g0dil Date: Fri, 19 Dec 2008 12:04:12 +0000 (+0000) Subject: Completely refactor install targets X-Git-Url: http://g0dil.de/git?p=senf.git;a=commitdiff_plain;h=87b37eb193532cdb47b2440b6a0c8ee76c7b2f6d Completely refactor install targets git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1027 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Examples/MCSniffer/SConscript b/Examples/MCSniffer/SConscript index 8d4e3b7..d7814c2 100644 --- a/Examples/MCSniffer/SConscript +++ b/Examples/MCSniffer/SConscript @@ -3,6 +3,5 @@ import SENFSCons ########################################################################### -SENFSCons.Binary(env, 'mcsniffer', SENFSCons.GlobSources(), - LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Utils' ], +SENFSCons.Binary(env, 'mcsniffer', SENFSCons.GlobSources(env), OBJECTS = [ '#/Packets/DefaultBundle/DefaultBundle.o' ]); diff --git a/Examples/MultiMCLoop/SConscript b/Examples/MultiMCLoop/SConscript index 83a6234..6715a54 100644 --- a/Examples/MultiMCLoop/SConscript +++ b/Examples/MultiMCLoop/SConscript @@ -3,5 +3,4 @@ import SENFSCons ########################################################################### -SENFSCons.Binary(env, 'multimcloop', [ 'MultiMCLoop.cc' ], - LIBS = [ 'Scheduler', 'Socket', 'Utils' ]) +SENFSCons.Binary(env, 'multimcloop', [ 'MultiMCLoop.cc' ]) diff --git a/Examples/RateStuffer/SConscript b/Examples/RateStuffer/SConscript index dec0b30..e576fb5 100644 --- a/Examples/RateStuffer/SConscript +++ b/Examples/RateStuffer/SConscript @@ -3,9 +3,7 @@ import SENFSCons ########################################################################### -SENFSCons.Binary( env, 'ratestuffer', SENFSCons.GlobSources(), - LIBS = [ 'PPI', 'Scheduler', 'Packets', 'Socket', 'Utils' ] ); - +SENFSCons.Binary(env, 'ratestuffer', SENFSCons.GlobSources(env)); SENFSCons.Doxygen(env, extra_sources=[ env.Dia2Png('ratestuffer.dia') ]) diff --git a/Examples/Sniffer/SConscript b/Examples/Sniffer/SConscript index ecf3cad..20e23b7 100644 --- a/Examples/Sniffer/SConscript +++ b/Examples/Sniffer/SConscript @@ -3,8 +3,5 @@ import SENFSCons ########################################################################### -SENFSCons.Binary(env, 'sniffer', SENFSCons.GlobSources(), LIBS = [ - 'Packets_DefaultBundle', 'Packets_MPEGDVBBundle', - 'Scheduler', 'Packets', 'Socket', 'Utils' ]) - +SENFSCons.Binary(env, 'sniffer', SENFSCons.GlobSources(env)) SENFSCons.Doxygen(env) diff --git a/Examples/TCPClientServer/SConscript b/Examples/TCPClientServer/SConscript index aed8d30..203c81d 100644 --- a/Examples/TCPClientServer/SConscript +++ b/Examples/TCPClientServer/SConscript @@ -3,8 +3,5 @@ import SENFSCons ########################################################################### -SENFSCons.Binary(env, 'client', 'client.cc', - LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]); - -SENFSCons.Binary(env, 'server', 'server.cc', - LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]); +SENFSCons.Binary(env, 'client', 'client.cc'); +SENFSCons.Binary(env, 'server', 'server.cc'); diff --git a/Examples/UDPClientServer/SConscript b/Examples/UDPClientServer/SConscript index 8fffdaa..cd426a8 100644 --- a/Examples/UDPClientServer/SConscript +++ b/Examples/UDPClientServer/SConscript @@ -3,10 +3,6 @@ import SENFSCons ########################################################################### -SENFSCons.Binary(env, 'udpClient', 'udpClient.cc', - LIBS = [ 'Packets', 'Socket', 'Scheduler', 'Utils' ]); - -SENFSCons.Binary(env, 'udpServer', 'udpServer.cc', - LIBS = [ 'Scheduler', 'Packets', 'Socket', 'Scheduler', 'Utils' ]); - +SENFSCons.Binary(env, 'udpClient', 'udpClient.cc'); +SENFSCons.Binary(env, 'udpServer', 'udpServer.cc',); SENFSCons.Doxygen(env) diff --git a/PPI/SConscript b/PPI/SConscript index 1f4ac10..de2d369 100644 --- a/PPI/SConscript +++ b/PPI/SConscript @@ -3,24 +3,18 @@ import SENFSCons, glob ########################################################################### -SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") - if f not in ('all_includes.hh','PPI.hh') and not f.endswith('.test.hh') ]) - SConscript(glob.glob("*/SConscript")) -sources = SENFSCons.GlobSources(subdirs=[ 'detail' ]) +SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") + if f not in ('all_includes.hh','PPI.hh') \ + and not f.endswith('.test.hh') ]) +sources, includes = SENFSCons.Glob(env, subdirs=[ 'detail' ]) SENFSCons.StandardTargets(env) - -SENFSCons.Lib(env, - library = 'PPI', - sources = sources, - LIBS = [ 'Scheduler', 'Packets', 'Logger', 'Console', 'Socket', 'Utils' ]) - +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env, extra_sources=[ env.Dia2Png('scenario.dia'), env.Dia2Png('classes.dia'), env.Dia2Png('ratestuffer.dia'), ]) - -SENFSCons.InstallIncludeFiles(env, [ 'PPI.hh', 'all_includes.hh' ]) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Packets/80211Bundle/SConscript b/Packets/80211Bundle/SConscript index b8952e4..2f25bc2 100644 --- a/Packets/80211Bundle/SConscript +++ b/Packets/80211Bundle/SConscript @@ -5,18 +5,11 @@ import SENFSCons, glob ########################################################################### -sources = SENFSCons.GlobSources() +sources, includes = SENFSCons.Glob(env) SENFSCons.StandardTargets(env) +SENFSCons.Object(env, target='80211Bundle', sources=sources) +SENFSCons.Lib(env, sources=sources[0]) +SENFSCons.InstallIncludeFiles(env, includes) -SENFSCons.Object(env, - target = '80211Bundle', - sources=sources, - LIBS = ['Packets', 'Socket', 'Utils']) - -SENFSCons.Lib(env, - library = 'Packets_80211Bundle', - sources = sources[0], - no_includes = 1) - SConscript(glob.glob("*/SConscript")) diff --git a/Packets/DefaultBundle/SConscript b/Packets/DefaultBundle/SConscript index ca95750..1f70312 100644 --- a/Packets/DefaultBundle/SConscript +++ b/Packets/DefaultBundle/SConscript @@ -5,18 +5,10 @@ import SENFSCons, glob ########################################################################### -sources = SENFSCons.GlobSources() - +sources, includes = SENFSCons.Glob(env) SENFSCons.StandardTargets(env) +SENFSCons.Object(env, target='DefaultBundle', sources=sources) +SENFSCons.Lib(env, sources[0]) +SENFSCons.InstallIncludeFiles(env, includes) -SENFSCons.Object(env, - target = 'DefaultBundle', - sources=sources, - LIBS = ['Packets', 'Socket', 'Utils']) - -SENFSCons.Lib(env, - library = 'Packets_DefaultBundle', - sources = sources[0], - no_includes = 1) - SConscript(glob.glob("*/SConscript")) diff --git a/Packets/DefaultBundle/extra_tests/SConscript b/Packets/DefaultBundle/extra_tests/SConscript index 19777cd..f3b2df8 100644 --- a/Packets/DefaultBundle/extra_tests/SConscript +++ b/Packets/DefaultBundle/extra_tests/SConscript @@ -5,5 +5,4 @@ import SENFSCons, glob ########################################################################### -SENFSCons.Test(env, sources = glob.glob("*.test.cc"), - LIBS = [ 'Packets_DefaultBundle', 'Packets', 'Socket', 'Utils' ]) +SENFSCons.Test(env, sources = glob.glob("*.test.cc")) diff --git a/Packets/MPEGDVBBundle/SConscript b/Packets/MPEGDVBBundle/SConscript index 8bb2942..b998615 100644 --- a/Packets/MPEGDVBBundle/SConscript +++ b/Packets/MPEGDVBBundle/SConscript @@ -5,16 +5,9 @@ import SENFSCons, glob ########################################################################### -sources = SENFSCons.GlobSources() +sources, includes = SENFSCons.Glob(env) SENFSCons.StandardTargets(env) - -SENFSCons.Object(env, - target = 'MPEGDVBBundle', - sources = sources, - LIBS = ['Packets_DefaultBundle', 'Packets', 'Socket', 'Utils']) - -SENFSCons.Lib(env, - library = 'Packets_MPEGDVBBundle', - sources = sources[0], - no_includes = 1) +SENFSCons.Object(env, target='MPEGDVBBundle', sources=sources) +SENFSCons.Lib(env, sources[0]) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Packets/SConscript b/Packets/SConscript index 287812c..64aa7a7 100644 --- a/Packets/SConscript +++ b/Packets/SConscript @@ -5,19 +5,15 @@ import SENFSCons, glob ########################################################################### -#SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") -# if 'defined(HH_Packets__decls_)' in file(f).read() ]) +sources, includes = SENFSCons.Glob(env) SENFSCons.StandardTargets(env) -SENFSCons.Lib(env, - library = 'Packets', - sources = SENFSCons.GlobSources(), - LIBS = [ 'Logger', 'Scheduler', 'Socket', 'Utils' ]) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env, extra_sources = [ env.Dia2Png("structure.dia"), env.Dia2Png("MPEGDVBBundle/TLV.dia") ]) +SENFSCons.InstallIncludeFiles(env, includes) SConscript(glob.glob("*/SConscript")) -SENFSCons.InstallIncludeFiles(env, [ 'parse_fixed_setup.hh' , 'parse_setup.hh' ]) diff --git a/Scheduler/SConscript b/Scheduler/SConscript index 012f69e..fe44ea8 100644 --- a/Scheduler/SConscript +++ b/Scheduler/SConscript @@ -5,12 +5,9 @@ import SENFSCons ########################################################################### -sources = SENFSCons.GlobSources() -SENFSCons.StandardTargets(env) - -SENFSCons.Lib(env, - library = 'Scheduler', - sources = sources, - LIBS = [ 'Logger', 'Scheduler', 'Console', 'Utils' ]) +sources, includes = SENFSCons.Glob(env) +SENFSCons.StandardTargets(env) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/Protocols/DVB/SConscript b/Socket/Protocols/DVB/SConscript index 7bbb5ae..0b56081 100644 --- a/Socket/Protocols/DVB/SConscript +++ b/Socket/Protocols/DVB/SConscript @@ -5,20 +5,12 @@ import SENFSCons, glob ########################################################################### +SConscript(glob.glob("*/SConscript")) + SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if f not in ('all_includes.hh','DVB.hh') and not f.endswith('.test.hh') ]) -sources = SENFSCons.GlobSources() - -allob = [] - -allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) - -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : allob.extend(ob) - -SENFSCons.InstallIncludeFiles(env, [ 'DVB.hh', 'all_includes.hh' ]) +sources, includes = SENFSCons.Glob(env) -Return('allob') +SENFSCons.Lib(env, sources) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/Protocols/INet/SConscript b/Socket/Protocols/INet/SConscript index 733c840..e48d809 100644 --- a/Socket/Protocols/INet/SConscript +++ b/Socket/Protocols/INet/SConscript @@ -5,20 +5,12 @@ import SENFSCons, glob ########################################################################### +SConscript(glob.glob("*/SConscript")) + SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if f not in ('all_includes.hh','INet.hh') and not f.endswith('.test.hh') ]) -sources = SENFSCons.GlobSources() - -allob = [] - -allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) - -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : allob.extend(ob) - -SENFSCons.InstallIncludeFiles(env, [ 'INet.hh', 'all_includes.hh' ]) +sources, includes = SENFSCons.Glob(env) -Return('allob') +SENFSCons.Lib(env, sources) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/Protocols/Raw/SConscript b/Socket/Protocols/Raw/SConscript index d461a08..7c58379 100644 --- a/Socket/Protocols/Raw/SConscript +++ b/Socket/Protocols/Raw/SConscript @@ -5,20 +5,12 @@ import SENFSCons, glob ########################################################################### +SConscript(glob.glob("*/SConscript")) + SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if f not in ('all_includes.hh','Raw.hh') and not f.endswith('.test.hh') ]) -sources = SENFSCons.GlobSources() - -allob = [] - -allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) - -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : allob.extend(ob) - -SENFSCons.InstallIncludeFiles(env, [ 'Raw.hh', 'all_includes.hh' ]) +sources, includes = SENFSCons.Glob(env) -Return('allob') +SENFSCons.Lib(env, sources) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/Protocols/SConscript b/Socket/Protocols/SConscript index e0e2d49..6e76b25 100644 --- a/Socket/Protocols/SConscript +++ b/Socket/Protocols/SConscript @@ -5,15 +5,10 @@ import SENFSCons, glob ########################################################################### -SENFSCons.StandardTargets(env) - -sources = SENFSCons.GlobSources() -objects = SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) +SConscript(glob.glob("*/SConscript")) -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : objects.extend(ob) - -SENFSCons.InstallIncludeFiles(env, [ 'INet.hh', 'Raw.hh', 'DVB.hh', 'UN.hh' ]) +SENFSCons.StandardTargets(env) -Return('objects') +sources, includes = SENFSCons.Glob(env) +SENFSCons.Lib(env, sources) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/Protocols/UN/SConscript b/Socket/Protocols/UN/SConscript index b1c332f..021bbe6 100644 --- a/Socket/Protocols/UN/SConscript +++ b/Socket/Protocols/UN/SConscript @@ -5,20 +5,12 @@ import SENFSCons, glob ########################################################################### +SConscript(glob.glob("*/SConscript")) + SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if f not in ('all_includes.hh','UN.hh') and not f.endswith('.test.hh') ]) -sources = SENFSCons.GlobSources() - -allob = [] - -allob.extend( - SENFSCons.Objects( env, sources = sources, LIBS = [ 'Socket', 'Scheduler', 'Utils' ] ) ) - -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : allob.extend(ob) - -SENFSCons.InstallIncludeFiles(env, [ 'UN.hh', 'all_includes.hh' ]) +sources, includes = SENFSCons.Glob(env) -Return('allob') +SENFSCons.Lib( env, sources) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Socket/SConscript b/Socket/SConscript index 3177782..9b0870f 100644 --- a/Socket/SConscript +++ b/Socket/SConscript @@ -5,24 +5,15 @@ import SENFSCons, glob ########################################################################### +SConscript(glob.glob("*/SConscript")) + SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if f not in ('all_includes.hh','Socket.hh') and not f.endswith('.test.hh') ]) -sources, testSources = SENFSCons.GlobSources() +sources, includes = SENFSCons.Glob(env) SENFSCons.StandardTargets(env) - -subob = [] -for sc in glob.glob("*/SConscript"): - ob = SConscript(sc) - if ob : subob.extend(ob) - -SENFSCons.Lib(env, - library = 'Socket', - sources = sources + subob, - testSources = testSources, - LIBS = [ 'Utils' ]) - +SENFSCons.Lib(env, sources = sources) SENFSCons.Doxygen(env, extra_sources = [ env.Dia2Png('SocketLibrary-classes.dia'), env.Dia2Png('FhHierarchy.dia'), @@ -30,5 +21,4 @@ SENFSCons.Doxygen(env, extra_sources = [ env.Dia2Png('Protocols.dia'), env.Dia2Png('Handle.dia'), ]) - -SENFSCons.InstallIncludeFiles(env, [ 'Socket.hh', 'all_includes.hh' ]) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Utils/Console/SConscript b/Utils/Console/SConscript index 5386352..31345a6 100644 --- a/Utils/Console/SConscript +++ b/Utils/Console/SConscript @@ -5,12 +5,9 @@ import SENFSCons ########################################################################### -sources = SENFSCons.GlobSources(exclude=['testServer.cc']) -SENFSCons.StandardTargets(env) - -SENFSCons.Lib(env, - library = 'Console', - sources = sources, - LIBS = [ 'Socket', 'Scheduler', 'Utils' ]) +sources, includes = SENFSCons.Glob(env, exclude=['testServer.cc']) +SENFSCons.StandardTargets(env) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Utils/Daemon/SConscript b/Utils/Daemon/SConscript index 2ca29de..a3ece3d 100644 --- a/Utils/Daemon/SConscript +++ b/Utils/Daemon/SConscript @@ -5,13 +5,9 @@ import SENFSCons, glob ########################################################################### -SENFSCons.StandardTargets(env) - -sources = SENFSCons.GlobSources() - -SENFSCons.Lib( env, - library = 'Utils_Daemon', - sources = sources, - LIBS = [ 'Logger', 'Scheduler', 'Socket', 'Utils' ] ) +sources, includes = SENFSCons.Glob(env) +SENFSCons.StandardTargets(env) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Utils/Logger/SConscript b/Utils/Logger/SConscript index c9e26fc..a25eede 100644 --- a/Utils/Logger/SConscript +++ b/Utils/Logger/SConscript @@ -5,15 +5,13 @@ import SENFSCons, glob ########################################################################### -SENFSCons.StandardTargets(env) - SENFSCons.AllIncludesHH(env, [ f for f in glob.glob("*.hh") if ( f not in ('all_includes.hh','Logger.hh','SenfLog.hh') and not f.endswith('.test.hh') ) ]) -sources = SENFSCons.GlobSources() -objects = SENFSCons.Lib( env, - library = 'Logger', - sources = sources, - LIBS = [ 'Scheduler', 'Socket', 'Utils' ] ) +sources, includes = SENFSCons.Glob(env) + +SENFSCons.StandardTargets(env) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env) +SENFSCons.InstallIncludeFiles(env, includes) diff --git a/Utils/SConscript b/Utils/SConscript index d17af8a..e07dec0 100644 --- a/Utils/SConscript +++ b/Utils/SConscript @@ -5,20 +5,11 @@ import SENFSCons, glob, os.path ########################################################################### -SENFSCons.StandardTargets(env) - -# OUCH ... another hack to work around a scons bug ... -if not os.path.exists("Logger/all_includes.hh"): - Execute(Touch("Logger/all_includes.hh")) - -sources, testSources = SENFSCons.GlobSources() -objects = SENFSCons.Objects( env, sources = sources, testSources=testSources ) - -lib = SENFSCons.Lib(env, - library = 'Utils', - sources = objects) +sources, includes = SENFSCons.Glob(env, subdirs=[ 'impl' ]) +SENFSCons.StandardTargets(env) +SENFSCons.Lib(env, sources) SENFSCons.Doxygen(env) -SENFSCons.InstallIncludeFiles(env, [ 'Logger.hh', 'Daemon.hh' ]) +SENFSCons.InstallIncludeFiles(env, includes) SConscript(glob.glob("*/SConscript")) diff --git a/senfscons/InstallIncludes.py b/senfscons/InstallIncludes.py deleted file mode 100644 index d9bb8f4..0000000 --- a/senfscons/InstallIncludes.py +++ /dev/null @@ -1,78 +0,0 @@ -## \file -# \brief InstallIncludes builder - -## \package senfscons.InstallIncludes -# \brief Install all include files which some targets depend upon -# -# \ingroup builder - -import SCons.Builder, SCons.Action, SCons.Environment, SCons.Node.FS -try: - from SCons.Tool.install import installFunc, stringFunc -except: - installFunc = SCons.Environment.installFunc - stringFunc = SCons.Environment.installString - -def recursiveChildren(f): - rv = {} - map(rv.setdefault,f) - for c in f: - if c is not None : map(rv.setdefault,recursiveChildren(c.children())) - return rv.keys() - -def filterIncludes(files, extensions): - return [ f for f in files - if f is not None and f.get_suffix() in extensions ] - -def filterIncludesInv(files, extensions): - return [ f for f in files - if f is not None and '.' + str(f).split('.',1)[-1] not in extensions ] - -def filterDirectory(files, dir): - return [ f for f in files - if f is not None and f.abspath.startswith(dir.abspath) ] - -def excludeDirectories(files, dirs): - return [ f for f in files - if not [ True for d in dirs if files.abspath.startswith(dirs.abspath) ] ] - -def emitter(target, source, env): - source = recursiveChildren(source) - source = filterIncludes(source, env['CPP_INCLUDE_EXTENSIONS']) - source = filterIncludesInv(source, env['CPP_EXCLUDE_EXTENSIONS']) - source = filterDirectory(source, env['INSTALL_BASE']) - source = excludeDirectories(source, env['INCLUDE_IGNORED_DIRECTORIES']) - - # Build target file by appending the path of 'src' relative to INSTALL_BASE to target[0] - target = [ target[0].File(src.get_path(env.Dir(env['INSTALL_BASE']))) - for src in source ] - - return (target, source) - -class Installer: - def __init__(self, target, source): - self.target = target; - self.source = source - - def __call__(self, target, source, env): - installFunc([self.target], [self.source], env) - -def generator(target, source, env, for_signature): - return [ SCons.Action.Action( Installer(trg, src), - lambda a,b,c,s=stringFunc([trg], [src], env):s ) - for trg, src in zip(target,source) ] - -InstallIncludes = SCons.Builder.Builder(emitter = emitter, - generator = generator, - source_factory = SCons.Node.FS.Entry, - target_factory = SCons.Node.FS.Dir, - name = 'InstallIncludesBuilder', - ) - -def generate(env): - env['BUILDERS']['InstallIncludes'] = InstallIncludes - env['INSTALL_BASE'] = '#' - env['INCLUDE_IGNORED_DIRECTORIES'] = [] - -def exists(env): - return 1 diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 812c30e..a16251e 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -51,7 +51,6 @@ SCONS_TOOLS = [ "Doxygen", "Dia2Png", "CopyToDir", - "InstallIncludes", "ProgramNoScan", "CompileCheck", ] @@ -295,7 +294,7 @@ def MakeEnvironment(): # in the current directory. The sources will be returned as a tuple of # sources, test-sources. The target helpers all accept such a tuple as # their source argument. -def GlobSources(exclude=[], subdirs=[]): +def GlobSources(env, exclude=[], subdirs=[]): testSources = glob.glob("*.test.cc") sources = [ x for x in glob.glob("*.cc") if x not in testSources and x not in exclude ] for subdir in subdirs: @@ -304,6 +303,22 @@ def GlobSources(exclude=[], subdirs=[]): if x not in testSources and x not in exclude ] return (sources, testSources) +def GlobIncludes(env, exclude=[], subdirs=[]): + includes = [] + for d in [ '.' ] + subdirs: + for f in os.listdir(d): + ext = '.' + f.split('.',1)[-1] + p = os.path.join(d,f) + if ext in env['CPP_INCLUDE_EXTENSIONS'] \ + and ext not in env['CPP_EXCLUDE_EXTENSIONS'] \ + and p not in exclude: + includes.append(p) + return includes + +def Glob(env, exclude=[], subdirs=[]): + return ( GlobSources(env, exclude, subdirs), + GlobIncludes(env, exclude, subdirs) ) + ## \brief Add generic standard targets for every module # # This target helper should be called in the top-level \c SConstruct file @@ -370,7 +385,7 @@ def Test(env, sources, LIBS = [], OBJECTS = []): # provide both \a sources and \a testSources. # # \ingroup target -def Objects(env, sources, testSources = None, LIBS = [], OBJECTS = [], no_includes = False): +def Objects(env, sources, testSources = None, OBJECTS = []): if type(sources) == type(()): testSources = sources[1] sources = sources[0] @@ -414,40 +429,11 @@ def InstallIncludeFiles(env, files): if env.GetOption('clean'): return target = env.Dir(env['INCLUDEINSTALLDIR']) - base = env.Dir(env['INSTALL_BASE']) + base = env.Dir('#') for f in files: src = env.File(f) env.Alias('install_all', env.Install(target.Dir(src.dir.get_path(base)), src)) -def InstallSourceIncludes(env, sources): - target = env.Dir(env['INCLUDEINSTALLDIR']).Dir( - env.Dir('.').get_path(env.Dir(env['INSTALL_BASE']))) - install = env.InstallIncludes( target = target, - source = [ type(x) is str and env.File(x) or x - for x in sources ], - INSTALL_BASE = env.Dir('.') ) - env.Alias( 'install_all', install ) - -def InstallWithSources(env, targets, dir, sources, testSources = [], no_includes = False): - if type(sources) is type(()): - sources, testSources = sources - if type(sources) is not type([]): - sources = [ sources ] - if type(testSources) is not type([]): - testSources = [ testSources ] - - installs = [ env.Install(dir, targets) ] - env.Alias( 'install_all', installs[:] ) - - if not no_includes: - sources = targets - if testSources: - sources.append( env.File('.test.bin') ) - installs.append( - InstallSourceIncludes(env, sources)) - - return installs - ## \brief Build documentation with doxygen # # The doxygen target helper will build software documentation using @@ -650,22 +636,21 @@ def DoxyXRef(env, docs=None, # The library is added to the list of default targets. # #\ingroup target -def Lib(env, library, sources, testSources = None, LIBS = [], OBJECTS = [], no_includes = False): - objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) +def Lib(env, sources, testSources = None, OBJECTS = []): + objects = Objects(env,sources,testSources,OBJECTS=OBJECTS) if objects: env.Append(ALLOBJECTS = objects) - InstallSourceIncludes(env, sources) return objects ## \brief Build Object from multiple sources -def Object(env, target, sources, testSources = None, LIBS = [], OBJECTS = [], no_includes = False): - objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) +def Object(env, target, sources, testSources = None, OBJECTS = []): + objects = Objects(env,sources,testSources,OBJECTS=OBJECTS) ob = None if objects: ob = env.Command(target+"${OBJADDSUFFIX}${OBJSUFFIX}", objects, "ld -r -o $TARGET $SOURCES") env.Default(ob) env.Alias('default', ob) - InstallSourceIncludes(env, sources) + env.Alias('install_all', env.Install("$OBJINSTALLDIR", ob)) return ob ## \brief Build executable @@ -678,8 +663,8 @@ def Object(env, target, sources, testSources = None, LIBS = [], OBJECTS = [], no # construction environment parameters or the framework helpers. # # \ingroup target -def Binary(env, binary, sources, testSources = None, LIBS = [], OBJECTS = [], no_includes = False): - objects = Objects(env,sources,testSources,LIBS=LIBS,OBJECTS=OBJECTS) +def Binary(env, binary, sources, testSources = None, OBJECTS = []): + objects = Objects(env,sources,testSources,OBJECTS=OBJECTS) program = None if objects: progEnv = env.Clone() @@ -688,7 +673,7 @@ def Binary(env, binary, sources, testSources = None, LIBS = [], OBJECTS = [], no env.Default(program) env.Depends(program, [ env.File(LibPath(env['LIBSENF'])) ]) env.Alias('default', program) - InstallWithSources(env, program, '$BININSTALLDIR', sources, testSources, no_includes) + env.Alias('install_all', env.Install('$BININSTALLDIR', program)) return program def AllIncludesHH(env, headers):