SCons: remove all explicit target and install specifications
now superfluous, because our custom builder handles that automatically
This commit is contained in:
parent
609873d90b
commit
abf1bc776b
5 changed files with 86 additions and 47 deletions
33
SConstruct
33
SConstruct
|
|
@ -38,10 +38,12 @@ LIBDIR = 'target/modules'
|
|||
#######
|
||||
buildExe = '#$TARGDIR'
|
||||
buildLib = '#$TARGDIR/modules'
|
||||
buildPlug = '#$TARGDIR/modules'
|
||||
buildIcon = '#$TARGDIR/icons'
|
||||
buildConf = '#$TARGDIR/config'
|
||||
installExe = '#$DESTDIR/lib/lumiera'
|
||||
installLib = '#$DESTDIR/lib/lumiera/modules'
|
||||
installPlug = '#$DESTDIR/lib/lumiera/modules'
|
||||
installIcon = '#$DESTDIR/share/lumiera/icons'
|
||||
installConf = '#$DESTDIR/share/lumiera/config'
|
||||
|
||||
|
|
@ -338,16 +340,16 @@ def defineBuildTargets(env, artifacts):
|
|||
|
||||
|
||||
|
||||
lLib = env.SharedLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib'))
|
||||
lApp = env.SharedLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common'), LIBS=lLib)
|
||||
lBack = env.SharedLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend'))
|
||||
lProc = env.SharedLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc'))
|
||||
lLib = env.SharedLibrary('lumiera', srcSubtree(env,'$SRCDIR/lib'), install=True)
|
||||
lApp = env.SharedLibrary('lumieracommon', srcSubtree(env,'$SRCDIR/common'), install=True, LIBS=lLib)
|
||||
lBack = env.SharedLibrary('lumierabackend', srcSubtree(env,'$SRCDIR/backend'),install=True)
|
||||
lProc = env.SharedLibrary('lumieraproc', srcSubtree(env,'$SRCDIR/proc'), install=True)
|
||||
|
||||
core = lLib+lApp+lBack+lProc
|
||||
|
||||
artifacts['corelib'] = core
|
||||
artifacts['support'] = lLib
|
||||
artifacts['lumiera'] = env.Program('$TARGDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core)
|
||||
artifacts['lumiera'] = env.Program('lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core, install=True)
|
||||
|
||||
# building Lumiera Plugins
|
||||
envPlu = env.Clone()
|
||||
|
|
@ -365,10 +367,10 @@ def defineBuildTargets(env, artifacts):
|
|||
# the Lumiera GTK GUI
|
||||
envGtk = env.Clone()
|
||||
envGtk.mergeConf(['gtkmm-2.4','gthread-2.0','cairomm-1.0','gdl','xv','xext','sm'])
|
||||
envGtk.Append(CPPDEFINES='LUMIERA_PLUGIN', LIBS=core)
|
||||
envGtk.Append(LIBS=core)
|
||||
|
||||
objgui = srcSubtree(envGtk,'$SRCDIR/gui')
|
||||
guimodule = envGtk.LumieraPlugin('$LIBDIR/gtk_gui', objgui, SHLIBPREFIX='', SHLIBSUFFIX='.lum')
|
||||
guimodule = envGtk.LumieraPlugin('gtk_gui', objgui, install=True)
|
||||
artifacts['gui'] = ( guimodule
|
||||
+ env.Install('$TARGDIR', env.Glob('$SRCDIR/gui/*.rc'))
|
||||
+ artifacts['icons']
|
||||
|
|
@ -404,20 +406,13 @@ def definePostBuildTargets(env, artifacts):
|
|||
|
||||
|
||||
def defineInstallTargets(env, artifacts):
|
||||
""" define 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
|
||||
for all executables automatically. see LumieraEnvironment.py
|
||||
"""
|
||||
binDir = '$DESTDIR/bin/'
|
||||
lumDir = '$DESTDIR/lib/lumiera/'
|
||||
modDir = '$DESTDIR/lib/lumiera/$MODULES/'
|
||||
shaDir = '$DESTDIR/share/lumiera/'
|
||||
env.Install(dir = modDir, source=artifacts['corelib'])
|
||||
env.Install(dir = modDir, source=artifacts['plugins'])
|
||||
env.Install(dir = modDir, source=artifacts['guimodule'])
|
||||
lumi = env.Install(dir = lumDir, source=artifacts['lumiera'])
|
||||
tool = env.Install(dir = lumDir, source=artifacts['tools'])
|
||||
env.SymLink(binDir+"lumiera",lumi,"../lib/lumiera/lumiera")
|
||||
env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera',"../lib/lumiera/lumiera")
|
||||
|
||||
env.Install(dir = shaDir, source="data/config/dummy_lumiera.ini") ### TODO should become a resource builder
|
||||
env.Install(dir = env.path.installConf, source="data/config/dummy_lumiera.ini") ### TODO should become a resource builder
|
||||
# env.Install(dir = '$DESTDIR/share/doc/lumiera$VERSION/devel', source=artifacts['doxydoc'])
|
||||
|
||||
#####################################################################
|
||||
|
|
|
|||
|
|
@ -148,13 +148,13 @@ def getDirname(dir):
|
|||
|
||||
|
||||
|
||||
def createPlugins(env, dir):
|
||||
def createPlugins(env, dir, **kw):
|
||||
""" 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.LumieraPlugin( '#$TARGDIR/$MODULES/%s' % getDirname(tree)
|
||||
return [env.LumieraPlugin( getDirname(tree)
|
||||
, srcSubtree(env, tree)
|
||||
, SHLIBPREFIX='', SHLIBSUFFIX='.lum'
|
||||
, **kw
|
||||
)
|
||||
for tree in findSrcTrees(dir)
|
||||
]
|
||||
|
|
|
|||
|
|
@ -113,7 +113,6 @@ class LumieraEnvironment(Environment):
|
|||
|
||||
|
||||
|
||||
|
||||
# extending the 'Configure' functionality of SCons,
|
||||
# especially for library dependency checking
|
||||
ConfigBase = SCons.SConf.SConfBase
|
||||
|
|
@ -133,7 +132,8 @@ class LumieraConfigContext(ConfigBase):
|
|||
|
||||
|
||||
|
||||
###### Lumiera custom tools and builders ########################
|
||||
###############################################################################
|
||||
####### Lumiera custom tools and builders #####################################
|
||||
|
||||
|
||||
def RegisterIcon_Builder(env):
|
||||
|
|
@ -190,7 +190,31 @@ class WrappedStandardExeBuilder(SCons.Util.Proxy):
|
|||
and then pass on the call to the wrapped original builder
|
||||
"""
|
||||
customisedEnv = self.getCustomEnvironment(env, target=target, **kw) # defined in subclasses
|
||||
return self.get().__call__ (customisedEnv, target, source, **kw)
|
||||
buildTarget = self.buildLocation(customisedEnv, target)
|
||||
buildTarget = self.invokeOriginalBuilder (customisedEnv, buildTarget, source, **kw)
|
||||
return buildTarget + self.installTarget(customisedEnv, buildTarget, **kw)
|
||||
|
||||
|
||||
def invokeOriginalBuilder(self, env, target, source, **kw):
|
||||
return self.get().__call__ (env, target, source, **kw)
|
||||
|
||||
def buildLocation(self, env, target):
|
||||
""" prefix project output directory """
|
||||
prefix = self.getBuildDestination(env)
|
||||
return list(prefix+str(name) for name in target)
|
||||
|
||||
def installTarget(self, env, buildTarget, **kw):
|
||||
""" create an additional installation target
|
||||
for the generated executable artifact
|
||||
"""
|
||||
indeedInstall = lambda p: p and p.get('install')
|
||||
|
||||
if indeedInstall(kw):
|
||||
return env.Install (dir = self.getInstallDestination(env), source=buildTarget)
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
|
||||
|
||||
class LumieraExeBuilder(WrappedStandardExeBuilder):
|
||||
|
|
@ -208,6 +232,11 @@ class LumieraExeBuilder(WrappedStandardExeBuilder):
|
|||
custEnv.Append( LINKFLAGS = "-Wl,-rpath=\\$$ORIGIN/$MODULES,--enable-new-dtags" )
|
||||
return custEnv
|
||||
|
||||
def getBuildDestination(self, lumiEnv): return lumiEnv.path.buildExe
|
||||
def getInstallDestination(self, lumiEnv): return lumiEnv.path.installExe
|
||||
|
||||
|
||||
|
||||
|
||||
class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
||||
|
||||
|
|
@ -219,6 +248,9 @@ class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
|||
custEnv.Append(LINKFLAGS = "-Wl,-soname="+self.defineSoname(target,**kw))
|
||||
return custEnv
|
||||
|
||||
def getBuildDestination(self, lumiEnv): return lumiEnv.path.buildLib
|
||||
def getInstallDestination(self, lumiEnv): return lumiEnv.path.installLib
|
||||
|
||||
|
||||
def defineSoname (self, target, **kw):
|
||||
""" internal helper to extract or guess
|
||||
|
|
@ -246,21 +278,33 @@ class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
|||
return soname
|
||||
|
||||
|
||||
|
||||
class LumieraPluginBuilder(LumieraModuleBuilder):
|
||||
|
||||
def getCustomEnvironment(self, lumiEnv, target, **kw):
|
||||
""" in addition to the ModuleBuilder, define the Lumiera plugin suffix
|
||||
"""
|
||||
custEnv = LumieraModuleBuilder.getCustomEnvironment(self, lumiEnv, target, **kw)
|
||||
custEnv.Append (CPPDEFINES='LUMIERA_PLUGIN')
|
||||
custEnv.Replace(SHLIBPREFIX='', SHLIBSUFFIX='.lum')
|
||||
return custEnv
|
||||
|
||||
def getBuildDestination(self, lumiEnv): return lumiEnv.path.buildPlug
|
||||
def getInstallDestination(self, lumiEnv): return lumiEnv.path.installPlug
|
||||
|
||||
|
||||
|
||||
def register_LumieraCustomBuilders (lumiEnv):
|
||||
""" install the customised builder versions tightly integrated with our buildsystem.
|
||||
Especially, these builders automatically add the build and installation locations
|
||||
and set the RPATH and SONAME in a way to allow a relocatable Lumiera directory structure
|
||||
"""
|
||||
programBuilder = lumiEnv['BUILDERS']['Program']
|
||||
libraryBuilder = lumiEnv['BUILDERS']['SharedLibrary']
|
||||
smoduleBuilder = lumiEnv['BUILDERS']['LoadableModule']
|
||||
programBuilder = LumieraExeBuilder (lumiEnv['BUILDERS']['Program'])
|
||||
libraryBuilder = LumieraModuleBuilder (lumiEnv['BUILDERS']['SharedLibrary'])
|
||||
smoduleBuilder = LumieraModuleBuilder (lumiEnv['BUILDERS']['LoadableModule'])
|
||||
lpluginBuilder = LumieraPluginBuilder (lumiEnv['BUILDERS']['LoadableModule'])
|
||||
|
||||
programBuilder = LumieraExeBuilder (programBuilder)
|
||||
libraryBuilder = LumieraModuleBuilder (libraryBuilder)
|
||||
smoduleBuilder = LumieraModuleBuilder (smoduleBuilder)
|
||||
lpluginBuilder = LumieraModuleBuilder (smoduleBuilder)
|
||||
|
||||
lumiEnv['BUILDERS']['Program'] = programBuilder
lumiEnv['BUILDERS']['SharedLibrary'] = libraryBuilder
lumiEnv['BUILDERS']['LoadableModule'] = smoduleBuilder
|
||||
lumiEnv['BUILDERS']['Program'] = programBuilder
|
||||
lumiEnv['BUILDERS']['SharedLibrary'] = libraryBuilder
|
||||
lumiEnv['BUILDERS']['LoadableModule'] = smoduleBuilder
|
||||
lumiEnv['BUILDERS']['LumieraPlugin'] = lpluginBuilder
|
||||
|
||||
|
||||
|
|
@ -12,12 +12,12 @@ envSvg.mergeConf(['librsvg-2.0'])
|
|||
envSvg.Append(LIBS=support_lib)
|
||||
|
||||
|
||||
luidgen = env.Program('#$TARGDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
|
||||
rsvg = envSvg.Program('#$TARGDIR/rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
|
||||
#luidgen = env.Program('luidgen', 'luidgen.c', LIBS=support_lib, install=True) ## for generating Lumiera-UIDs
|
||||
rsvg = envSvg.Program('rsvg-convert','rsvg-convert.c') ## for rendering SVG icons (uses librsvg)
|
||||
|
||||
# build additional test and administrative tools....
|
||||
artifacts['tools'] = [ env.Program('#$TARGDIR/hello-world','hello.c') #### hello world (checks C build)
|
||||
+ env.Program('#$TARGDIR/try', 'try.cpp') #### to try out some feature...
|
||||
artifacts['tools'] = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build)
|
||||
+ env.Program('try', 'try.cpp') #### to try out some feature...
|
||||
# + luidgen
|
||||
+ rsvg
|
||||
]
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ def testExecutable(env,tree, exeName=None, obj=None):
|
|||
obj = srcSubtree(env,tree, isShared=False) # use all sourcefiles found in subtree
|
||||
if not exeName:
|
||||
exeName = 'test-%s' % tree
|
||||
return env.Program('#$TARGDIR/'+exeName, obj + core)
|
||||
return env.Program(exeName, obj + core)
|
||||
|
||||
|
||||
def testCollection(env,dir):
|
||||
|
|
@ -44,7 +44,7 @@ def testCollection(env,dir):
|
|||
"""
|
||||
srcpatt = ['test-*.c']
|
||||
exeName = lambda p: path.basename(path.splitext(p)[0])
|
||||
buildIt = lambda p: env.Program("#$TARGDIR/"+exeName(p), [p] + core)
|
||||
buildIt = lambda p: env.Program(exeName(p), [p] + core)
|
||||
return [buildIt(f) for f in scanSubtree(dir,srcpatt)]
|
||||
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['bugs'] ]
|
|||
|
||||
|
||||
# for creating a Valgrind-Suppression file
|
||||
vgsuppr = env.Program('#$TARGDIR/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]
|
||||
Depends(ts,vgsuppr)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue