use import/export instead of passing an artefacts map

This commit is contained in:
Fischlurch 2012-01-09 02:56:29 +01:00
parent 25b21fe575
commit f84da63e11
5 changed files with 60 additions and 62 deletions

View file

@ -319,7 +319,7 @@ def configurePlatform(env):
def defineSetupTargets(env, artifacts): def defineSetupTargets(env):
""" build operations and targets to be done /before/ compiling. """ build operations and targets to be done /before/ compiling.
things like creating a source tarball or preparing a version header. things like creating a source tarball or preparing a version header.
""" """
@ -327,7 +327,7 @@ def defineSetupTargets(env, artifacts):
def defineBuildTargets(env, artifacts): def defineBuildTargets(env):
""" define the source file/dirs comprising each artifact to be built. """ define the source file/dirs comprising each artifact to be built.
setup sub-environments with special build options if necessary. setup sub-environments with special build options if necessary.
We use a custom function to declare a whole tree of srcfiles. We use a custom function to declare a whole tree of srcfiles.
@ -336,52 +336,51 @@ def defineBuildTargets(env, artifacts):
# define Icons to render and install # define Icons to render and install
vector_icon_dir = env.subst(env.path.srcIcon+'svg') vector_icon_dir = env.subst(env.path.srcIcon+'svg')
prerendered_icon_dir = env.subst(env.path.srcIcon+'prerendered') prerendered_icon_dir = env.subst(env.path.srcIcon+'prerendered')
print "ICON: vector_icon_dir=%s prerendered=%s" % (vector_icon_dir,prerendered_icon_dir) icons = ( [env.IconRender(f) for f in scanSubtree(vector_icon_dir, ['*.svg'])]
artifacts['icons'] = ( [env.IconRender(f) for f in scanSubtree(vector_icon_dir, ['*.svg'])] + [env.IconResource(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])]
+ [env.IconResource(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])] )
)
#define Configuration files to install #define Configuration files to install
artifacts['config'] = ( env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN') config = ( env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN')
+ env.ConfigData(env.path.srcConf+'dummy_lumiera.ini') + env.ConfigData(env.path.srcConf+'dummy_lumiera.ini')
) )
# call subdir SConscript(s) for independent components # call subdir SConscript(s) for independent components
SConscript(dirs=['src','src/tool','research','tests'], exports='env artifacts') SConscript(dirs=['src','src/tool','research','tests'], exports='env icons config')
def definePostBuildTargets(env, artifacts): def definePostBuildTargets(env):
""" define further actions after the core build (e.g. Documentation). """ define further actions after the core build (e.g. Documentation).
define alias targets to trigger the installing. define alias targets to trigger the installing.
""" """
build = env.Alias('build', ( artifacts['lumiera'] Import('lumiera plugins tools gui testsuite')
+ artifacts['plugins'] build = env.Alias('build', lumiera + plugins + tools +gui)
+ artifacts['tools']
+ artifacts['gui']
))
# additional files to be cleaned when cleaning 'build' # additional files to be cleaned when cleaning 'build'
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ]) env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ])
env.Clean ('build', [ 'src/pre.gch' ]) env.Clean ('build', [ 'src/pre.gch' ])
doxydoc = artifacts['doxydoc'] = env.Doxygen('doc/devel/Doxyfile') doxydoc = env.Doxygen('doc/devel/Doxyfile')
env.Alias ('doc', doxydoc) env.Alias ('doc', doxydoc)
env.Clean ('doc', doxydoc + ['doc/devel/,doxylog','doc/devel/warnings.txt']) env.Clean ('doc', doxydoc + ['doc/devel/,doxylog','doc/devel/warnings.txt'])
env.Alias ('all', build+artifacts['testsuite']+doxydoc) env.Alias ('all', build + testsuite + doxydoc)
env.Default('build') env.Default('build')
# SCons default target # SCons default target
def defineInstallTargets(env, artifacts): def defineInstallTargets(env):
""" define additional artifacts to be installed into target locations. """ define additional artifacts to be installed into target locations.
@note: we use customised SCons builders defining install targets @note: we use customised SCons builders defining install targets
for all executables automatically. see LumieraEnvironment.py for all executables automatically. see LumieraEnvironment.py
""" """
env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera') Import('lumiera plugins tools gui testsuite')
# env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=artifacts['doxydoc'])
env.Alias('install', artifacts['gui']) env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera')
# env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=doxydoc)
env.Alias('install', gui)
env.Alias('install', '$DESTDIR') env.Alias('install', '$DESTDIR')
##################################################################### #####################################################################
@ -397,7 +396,6 @@ env = setupBasicEnvironment(localDefinitions)
if not (isCleanupOperation(env) or isHelpRequest()): if not (isCleanupOperation(env) or isHelpRequest()):
env = configurePlatform(env) env = configurePlatform(env)
artifacts = {}
# the various things we build. # the various things we build.
# Each entry actually is a SCons-Node list. # Each entry actually is a SCons-Node list.
# Passing these entries to other builders defines dependencies. # Passing these entries to other builders defines dependencies.
@ -406,8 +404,8 @@ artifacts = {}
# 'plugins' : plugin shared lib # 'plugins' : plugin shared lib
# 'tools' : small tool applications (e.g mpegtoc) # 'tools' : small tool applications (e.g mpegtoc)
defineSetupTargets(env, artifacts) defineSetupTargets(env)
defineBuildTargets(env, artifacts) defineBuildTargets(env)
definePostBuildTargets(env, artifacts) definePostBuildTargets(env)
defineInstallTargets(env, artifacts) defineInstallTargets(env)

View file

@ -4,9 +4,8 @@
## Things defined here usuall won't be installed ## Things defined here usuall won't be installed
## ##
Import('env','artifacts','core') Import('env core support_lib')
support_lib = artifacts['support']

View file

@ -7,7 +7,7 @@
from Buildhelper import srcSubtree from Buildhelper import srcSubtree
from Buildhelper import scanSubtree from Buildhelper import scanSubtree
Import('env','artifacts') Import('env icons config')
lLib = env.SharedLibrary('lumiera', srcSubtree('lib'), install=True) lLib = env.SharedLibrary('lumiera', srcSubtree('lib'), install=True)
@ -15,16 +15,16 @@ lApp = env.SharedLibrary('lumieracommon', srcSubtree('common'), install=True,
lBack = env.SharedLibrary('lumierabackend', srcSubtree('backend'),install=True) lBack = env.SharedLibrary('lumierabackend', srcSubtree('backend'),install=True)
lProc = env.SharedLibrary('lumieraproc', srcSubtree('proc'), install=True) lProc = env.SharedLibrary('lumieraproc', srcSubtree('proc'), install=True)
core = lLib+lApp+lBack+lProc core = lLib+lApp+lBack+lProc
core_lib = core
support_lib = lLib
artifacts['corelib'] = core lumiera = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True)
artifacts['support'] = lLib + config
artifacts['lumiera'] = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True) )
+ artifacts['config']
)
# building Lumiera Plugins # building Lumiera Plugins
artifacts['plugins'] = [] # currently none plugins = [] # currently none
# the Lumiera GTK GUI # the Lumiera GTK GUI
@ -33,10 +33,10 @@ envGtk.mergeConf(['gtkmm-2.4','gthread-2.0','cairomm-1.0','gdl','xv','xext','sm'
envGtk.Append(LIBS=core) envGtk.Append(LIBS=core)
guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('gui'), install=True) guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('gui'), install=True)
artifacts['gui'] = ( guimodule gui = ( guimodule
+ [env.GuiResource(f) for f in env.Glob('gui/*.rc')] + icons
+ artifacts['icons'] + [env.GuiResource(f) for f in env.Glob('gui/*.rc')]
) )
Export('core') Export('lumiera core core_lib support_lib plugins gui')

View file

@ -3,9 +3,8 @@
## SConscript - SCons buildscript for tool subdirectory (called by SConstruct) ## SConscript - SCons buildscript for tool subdirectory (called by SConstruct)
## ##
Import('env','artifacts','core') Import('env core support_lib icons')
support_lib = artifacts['support']
envSvg = env.Clone() envSvg = env.Clone()
envSvg.mergeConf(['librsvg-2.0']) envSvg.mergeConf(['librsvg-2.0'])
@ -16,11 +15,12 @@ luidgen = env.Program('luidgen', ['luidgen.c'] + support_lib, install=True)
rsvg = envSvg.Program('rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg) rsvg = envSvg.Program('rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
# build additional test and administrative tools.... # build additional test and administrative tools....
artifacts['tools'] = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build) tools = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build)
+ luidgen + luidgen
+ rsvg + rsvg
] ]
Export('tools')
# Rendering the SVG Icons depends on rsvg-convert # Rendering the SVG Icons depends on rsvg-convert
env.Depends(artifacts['icons'], rsvg) env.Depends(icons, rsvg)

View file

@ -12,7 +12,7 @@ from Buildhelper import scanSubtree
from Buildhelper import globRootdirs from Buildhelper import globRootdirs
from Buildhelper import createPlugins from Buildhelper import createPlugins
Import('env','artifacts','core') Import('env core tools config')
env = env.Clone() env = env.Clone()
env.Append(CPPPATH='include') # additional headers for tests env.Append(CPPPATH='include') # additional headers for tests
@ -56,27 +56,28 @@ moduledirs = globRootdirs('*')
artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['lib','components'] ] testsuite = ( [ testExecutable(env, dir) for dir in ['lib','components'] ]
+ [ testCollection(env, dir) for dir in moduledirs if not dir in specials] + [ testCollection(env, dir) for dir in moduledirs if not dir in specials]
+ createPlugins(env, 'plugin') + createPlugins(env, 'plugin')
+ env.File(glob('*.tests')) # depending on the test definition files for test.sh + env.File(glob('*.tests')) # depending on the test definition files for test.sh
+ artifacts['config'] + config
) )
Export('testsuite')
# for creating a Valgrind-Suppression file # for creating a Valgrind-Suppression file
vgsuppr = env.Program('vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms vgsuppr = env.Program('vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
artifacts['tools'] += [vgsuppr] tools += [vgsuppr]
Depends(ts,vgsuppr) Depends(testsuite,vgsuppr)
# #
# actually run the Testsuite # actually run the Testsuite
# #
# - the product of running the Testsuite is the ",testlog" # - the product of running the Testsuite is the ",testlog"
# - it depends on all artifacts defined as "ts" above # - it depends on all artifacts defined as "testsuite" above
# - including the tests/*.tests (suite definition files) # - including the tests/*.tests (suite definition files)
# - if not set via options switch, the environment variables # - if not set via options switch, the environment variables
# TESTSUITES and VALGRINDFLAGS are explicitly propagated to test.sh # TESTSUITES and VALGRINDFLAGS are explicitly propagated to test.sh
@ -106,7 +107,7 @@ testEnv['ENV']['TEST_CONF'] = env.File("test.conf").abspath
testDir = env.Dir('#$TARGDIR') testDir = env.Dir('#$TARGDIR')
runTest = env.File("test.sh").abspath runTest = env.File("test.sh").abspath
runTs = testEnv.Command('#$TARGDIR/,testlog', ts, runTest, chdir=testDir) runTests = testEnv.Command('#$TARGDIR/,testlog', testsuite, runTest, chdir=testDir)
@ -115,8 +116,8 @@ runTs = testEnv.Command('#$TARGDIR/,testlog', ts, runTest, chdir=testDir)
# - 'scons testcode' triggers building of the Testsuite # - 'scons testcode' triggers building of the Testsuite
# - 'scons check' triggers building and running # - 'scons check' triggers building and running
# #
env.Alias('testcode', ts ) env.Alias('testcode', testsuite )
env.Alias('check', runTs ) env.Alias('check', runTests )
# allow tempfiles of test.sh to be cleaned # allow tempfiles of test.sh to be cleaned
env.Clean ('check', [',testlog',',testlog.pre',',expect_stdout',',stdout',',stderr',',testtmp','.libs']) env.Clean ('check', [',testlog',',testlog.pre',',expect_stdout',',stdout',',stderr',',testtmp','.libs'])