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.
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.
setup sub-environments with special build options if necessary.
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
vector_icon_dir = env.subst(env.path.srcIcon+'svg')
prerendered_icon_dir = env.subst(env.path.srcIcon+'prerendered')
print "ICON: vector_icon_dir=%s prerendered=%s" % (vector_icon_dir,prerendered_icon_dir)
artifacts['icons'] = ( [env.IconRender(f) for f in scanSubtree(vector_icon_dir, ['*.svg'])]
+ [env.IconResource(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])]
)
icons = ( [env.IconRender(f) for f in scanSubtree(vector_icon_dir, ['*.svg'])]
+ [env.IconResource(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])]
)
#define Configuration files to install
artifacts['config'] = ( env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN')
+ env.ConfigData(env.path.srcConf+'dummy_lumiera.ini')
)
config = ( env.ConfigData(env.path.srcConf+'setup.ini', targetDir='$ORIGIN')
+ env.ConfigData(env.path.srcConf+'dummy_lumiera.ini')
)
# 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 alias targets to trigger the installing.
"""
build = env.Alias('build', ( artifacts['lumiera']
+ artifacts['plugins']
+ artifacts['tools']
+ artifacts['gui']
))
Import('lumiera plugins tools gui testsuite')
build = env.Alias('build', lumiera + plugins + tools +gui)
# additional files to be cleaned when cleaning 'build'
env.Clean ('build', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log' ])
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.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')
# SCons default target
def defineInstallTargets(env, artifacts):
def defineInstallTargets(env):
""" define additional artifacts to be installed into target locations.
@note: we use customised SCons builders defining install targets
for all executables automatically. see LumieraEnvironment.py
"""
env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera','../lib/lumiera/lumiera')
# env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=artifacts['doxydoc'])
Import('lumiera plugins tools gui testsuite')
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')
#####################################################################
@ -397,7 +396,6 @@ env = setupBasicEnvironment(localDefinitions)
if not (isCleanupOperation(env) or isHelpRequest()):
env = configurePlatform(env)
artifacts = {}
# the various things we build.
# Each entry actually is a SCons-Node list.
# Passing these entries to other builders defines dependencies.
@ -406,8 +404,8 @@ artifacts = {}
# 'plugins' : plugin shared lib
# 'tools' : small tool applications (e.g mpegtoc)
defineSetupTargets(env, artifacts)
defineBuildTargets(env, artifacts)
definePostBuildTargets(env, artifacts)
defineInstallTargets(env, artifacts)
defineSetupTargets(env)
defineBuildTargets(env)
definePostBuildTargets(env)
defineInstallTargets(env)

View file

@ -4,9 +4,8 @@
## 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 scanSubtree
Import('env','artifacts')
Import('env icons config')
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)
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
artifacts['support'] = lLib
artifacts['lumiera'] = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True)
+ artifacts['config']
)
lumiera = ( env.Program('lumiera', ['lumiera/main.cpp'] + core, install=True)
+ config
)
# building Lumiera Plugins
artifacts['plugins'] = [] # currently none
plugins = [] # currently none
# 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)
guimodule = envGtk.LumieraPlugin('gtk_gui', srcSubtree('gui'), install=True)
artifacts['gui'] = ( guimodule
+ [env.GuiResource(f) for f in env.Glob('gui/*.rc')]
+ artifacts['icons']
)
gui = ( guimodule
+ 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)
##
Import('env','artifacts','core')
Import('env core support_lib icons')
support_lib = artifacts['support']
envSvg = env.Clone()
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)
# build additional test and administrative tools....
artifacts['tools'] = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build)
+ luidgen
+ rsvg
]
tools = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build)
+ luidgen
+ rsvg
]
Export('tools')
# 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 createPlugins
Import('env','artifacts','core')
Import('env core tools config')
env = env.Clone()
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'] ]
+ [ testCollection(env, dir) for dir in moduledirs if not dir in specials]
+ createPlugins(env, 'plugin')
+ env.File(glob('*.tests')) # depending on the test definition files for test.sh
+ artifacts['config']
)
testsuite = ( [ testExecutable(env, dir) for dir in ['lib','components'] ]
+ [ testCollection(env, dir) for dir in moduledirs if not dir in specials]
+ createPlugins(env, 'plugin')
+ env.File(glob('*.tests')) # depending on the test definition files for test.sh
+ config
)
Export('testsuite')
# for creating a Valgrind-Suppression file
vgsuppr = env.Program('vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
artifacts['tools'] += [vgsuppr]
Depends(ts,vgsuppr)
tools += [vgsuppr]
Depends(testsuite,vgsuppr)
#
# actually run the Testsuite
#
# - 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)
# - if not set via options switch, the environment variables
# 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')
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 check' triggers building and running
#
env.Alias('testcode', ts )
env.Alias('check', runTs )
env.Alias('testcode', testsuite )
env.Alias('check', runTests )
# allow tempfiles of test.sh to be cleaned
env.Clean ('check', [',testlog',',testlog.pre',',expect_stdout',',stdout',',stderr',',testtmp','.libs'])