SCons: use new plugin building rule for the test plugins

This commit is contained in:
Fischlurch 2009-01-12 12:48:14 +01:00
parent d4c9e413e0
commit ac156231ac
3 changed files with 15 additions and 28 deletions

View file

@ -28,6 +28,7 @@ CUSTOPTIONSFILE = 'custom-options'
SRCDIR = 'src'
BINDIR = 'bin'
LIBDIR = '.libs'
PLUGDIR = '.libs'
TESTDIR = 'tests'
ICONDIR = 'icons'
VERSION = '0.1+pre.01'
@ -74,6 +75,7 @@ def setupBasicEnvironment():
, SRCDIR=SRCDIR
, BINDIR=BINDIR
, LIBDIR=LIBDIR
, PLUGDIR=PLUGDIR
, ICONDIR=ICONDIR
, CPPPATH=["#"+SRCDIR] # used to find includes, "#" means always absolute to build-root
, CPPDEFINES=['-DLUMIERA_VERSION='+VERSION ] # note: it's a list to append further defines
@ -336,12 +338,15 @@ def defineBuildTargets(env, artifacts):
artifacts['lumiera'] = env.Program('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
artifacts['corelib'] = core
# building Lumiera Plugins
envPlu = env.Clone()
envPlu.Append(CPPDEFINES='LUMIERA_PLUGIN')
artifacts['plugins'] = [] # currently none
# the Lumiera GTK GUI
envgtk = env.Clone().mergeConf(['gtkmm-2.4','cairomm-1.0','gdl-1.0','librsvg-2.0','xv','xext','sm'])
envgtk = env.Clone()
envgtk.mergeConf(['gtkmm-2.4','cairomm-1.0','gdl-1.0','librsvg-2.0','xv','xext','sm'])
envgtk.Append(CPPDEFINES='LUMIERA_PLUGIN', LIBS=core)
objgui = srcSubtree(envgtk,'$SRCDIR/gui')
@ -362,7 +367,7 @@ def defineBuildTargets(env, artifacts):
# call subdir SConscript(s) for independent components
SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts core')
SConscript(dirs=['admin'], exports='env envgtk artifacts core')
SConscript(dirs=[TESTDIR], exports='env artifacts core')
SConscript(dirs=[TESTDIR], exports='env envPlu artifacts core')

View file

@ -151,7 +151,7 @@ def createPlugins(env, dir):
""" investigate the given source directory to identify all contained source trees.
@return: a list of build nodes defining a plugin for each of these source trees.
"""
return [env.LoadableModule( '$PLUGDIR/%s' % getDirname(tree)
return [env.LoadableModule( '#$PLUGDIR/%s' % getDirname(tree)
, srcSubtree(env, tree)
, SHLIBPREFIX='', SHLIBSUFFIX='.lum'
)

View file

@ -8,12 +8,15 @@ from os import path
from Buildhelper import srcSubtree
from Buildhelper import scanSubtree
from Buildhelper import globRootdirs
from Buildhelper import createPlugins
Import('env','artifacts','core')
Import('env','envPlu','artifacts','core')
# temp fix to add test.h -- wouldn't it be better to put this header be into src/lib ?
env = env.Clone()
env.Append(CPPPATH='#/.') # add Rootdir to Includepath, so test/test.h is found
envPlu = envPlu.Clone()
envPlu.Append(CPPPATH='#/.')
# temp fix-------------
def testExecutable(env,tree, exeName=None, obj=None):
@ -43,39 +46,18 @@ def testCollection(env,dir):
return [buildIt(f) for f in scanSubtree(dir,srcpatt)]
def treatPluginTestcase(env):
""" Special case: the test-plugin executable
"""
tree = 'plugin'
env = env.Clone()
env.Append(CPPPATH=tree, CPPDEFINES='LUMIERA_PLUGIN')
prfx = path.join(tree,'example_plugin')
oC = env.SharedObject(prfx, prfx+'.c')
oCPP = env.SharedObject(prfx+'_cpp', prfx+'.cpp')
testplugin = ( env.LoadableModule('#$LIBDIR/examplepluginc', oC, SHLIBPREFIX='')
# + env.SharedLibrary('#$LIBDIR/exampleplugincpp', oCPP, SHLIBPREFIX='')
# doesn't compile yet...
)
return testplugin
#-- it depends (at the moment) on a specific isolated test-plugin,
# which is not integrated in the "normal procedure" for building Plugins
# (which is not yet implemented as of 8/07)
# TODO: handle this case automatically
#
# build a Test-Executable out of every subdir...
moduledirs = globRootdirs('*')
# but have to treat some subdirs individually.
specials = ['plugin','lib','components']
moduledirs = globRootdirs('*')
artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['lib','components'] ]
+ treatPluginTestcase(env)
+ [ testCollection(env, dir) for dir in moduledirs if not dir in specials]
+ createPlugins(envPlu, 'plugin')
)