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'
|
buildExe = '#$TARGDIR'
|
||||||
buildLib = '#$TARGDIR/modules'
|
buildLib = '#$TARGDIR/modules'
|
||||||
|
buildPlug = '#$TARGDIR/modules'
|
||||||
buildIcon = '#$TARGDIR/icons'
|
buildIcon = '#$TARGDIR/icons'
|
||||||
buildConf = '#$TARGDIR/config'
|
buildConf = '#$TARGDIR/config'
|
||||||
installExe = '#$DESTDIR/lib/lumiera'
|
installExe = '#$DESTDIR/lib/lumiera'
|
||||||
installLib = '#$DESTDIR/lib/lumiera/modules'
|
installLib = '#$DESTDIR/lib/lumiera/modules'
|
||||||
|
installPlug = '#$DESTDIR/lib/lumiera/modules'
|
||||||
installIcon = '#$DESTDIR/share/lumiera/icons'
|
installIcon = '#$DESTDIR/share/lumiera/icons'
|
||||||
installConf = '#$DESTDIR/share/lumiera/config'
|
installConf = '#$DESTDIR/share/lumiera/config'
|
||||||
|
|
||||||
|
|
@ -338,16 +340,16 @@ def defineBuildTargets(env, artifacts):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lLib = env.SharedLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib'))
|
lLib = env.SharedLibrary('lumiera', srcSubtree(env,'$SRCDIR/lib'), install=True)
|
||||||
lApp = env.SharedLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common'), LIBS=lLib)
|
lApp = env.SharedLibrary('lumieracommon', srcSubtree(env,'$SRCDIR/common'), install=True, LIBS=lLib)
|
||||||
lBack = env.SharedLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend'))
|
lBack = env.SharedLibrary('lumierabackend', srcSubtree(env,'$SRCDIR/backend'),install=True)
|
||||||
lProc = env.SharedLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc'))
|
lProc = env.SharedLibrary('lumieraproc', srcSubtree(env,'$SRCDIR/proc'), install=True)
|
||||||
|
|
||||||
core = lLib+lApp+lBack+lProc
|
core = lLib+lApp+lBack+lProc
|
||||||
|
|
||||||
artifacts['corelib'] = core
|
artifacts['corelib'] = core
|
||||||
artifacts['support'] = lLib
|
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
|
# building Lumiera Plugins
|
||||||
envPlu = env.Clone()
|
envPlu = env.Clone()
|
||||||
|
|
@ -365,10 +367,10 @@ def defineBuildTargets(env, artifacts):
|
||||||
# the Lumiera GTK GUI
|
# the Lumiera GTK GUI
|
||||||
envGtk = env.Clone()
|
envGtk = env.Clone()
|
||||||
envGtk.mergeConf(['gtkmm-2.4','gthread-2.0','cairomm-1.0','gdl','xv','xext','sm'])
|
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')
|
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
|
artifacts['gui'] = ( guimodule
|
||||||
+ env.Install('$TARGDIR', env.Glob('$SRCDIR/gui/*.rc'))
|
+ env.Install('$TARGDIR', env.Glob('$SRCDIR/gui/*.rc'))
|
||||||
+ artifacts['icons']
|
+ artifacts['icons']
|
||||||
|
|
@ -404,20 +406,13 @@ def definePostBuildTargets(env, artifacts):
|
||||||
|
|
||||||
|
|
||||||
def defineInstallTargets(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/'
|
env.SymLink('$DESTDIR/bin/lumiera',env.path.installExe+'lumiera',"../lib/lumiera/lumiera")
|
||||||
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.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'])
|
# 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.
|
""" 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: 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)
|
, srcSubtree(env, tree)
|
||||||
, SHLIBPREFIX='', SHLIBSUFFIX='.lum'
|
, **kw
|
||||||
)
|
)
|
||||||
for tree in findSrcTrees(dir)
|
for tree in findSrcTrees(dir)
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class LumieraEnvironment(Environment):
|
||||||
self.path = Record (pathConfig)
|
self.path = Record (pathConfig)
|
||||||
self.libInfo = {}
|
self.libInfo = {}
|
||||||
self.Tool("BuilderGCH")
|
self.Tool("BuilderGCH")
|
||||||
self.Tool("BuilderDoxygen")
|
self.Tool("BuilderDoxygen")
|
||||||
self.Tool("ToolDistCC")
|
self.Tool("ToolDistCC")
|
||||||
self.Tool("ToolCCache")
|
self.Tool("ToolCCache")
|
||||||
RegisterIcon_Builder(self)
|
RegisterIcon_Builder(self)
|
||||||
|
|
@ -108,7 +108,6 @@ class LumieraEnvironment(Environment):
|
||||||
|
|
||||||
action = Action(makeLink,reportLink)
|
action = Action(makeLink,reportLink)
|
||||||
self.Command (target,source, action)
|
self.Command (target,source, action)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -133,7 +132,8 @@ class LumieraConfigContext(ConfigBase):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###### Lumiera custom tools and builders ########################
|
###############################################################################
|
||||||
|
####### Lumiera custom tools and builders #####################################
|
||||||
|
|
||||||
|
|
||||||
def RegisterIcon_Builder(env):
|
def RegisterIcon_Builder(env):
|
||||||
|
|
@ -163,12 +163,12 @@ def RegisterIcon_Builder(env):
|
||||||
subdir = getDirname(source)
|
subdir = getDirname(source)
|
||||||
return env.Install("$TARGDIR/%s" % subdir, source)
|
return env.Install("$TARGDIR/%s" % subdir, source)
|
||||||
|
|
||||||
|
|
||||||
buildIcon = env.Builder( action = Action(invokeRenderer, "rendering Icon: $SOURCE --> $TARGETS")
|
buildIcon = env.Builder( action = Action(invokeRenderer, "rendering Icon: $SOURCE --> $TARGETS")
|
||||||
, single_source = True
|
, single_source = True
|
||||||
, emitter = createIconTargets
|
, emitter = createIconTargets
|
||||||
)
|
)
|
||||||
env.Append(BUILDERS = {'IconRender' : buildIcon})
|
env.Append(BUILDERS = {'IconRender' : buildIcon})
|
||||||
env.AddMethod(IconCopy)
|
env.AddMethod(IconCopy)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -190,7 +190,31 @@ class WrappedStandardExeBuilder(SCons.Util.Proxy):
|
||||||
and then pass on the call to the wrapped original builder
|
and then pass on the call to the wrapped original builder
|
||||||
"""
|
"""
|
||||||
customisedEnv = self.getCustomEnvironment(env, target=target, **kw) # defined in subclasses
|
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):
|
class LumieraExeBuilder(WrappedStandardExeBuilder):
|
||||||
|
|
@ -207,6 +231,11 @@ class LumieraExeBuilder(WrappedStandardExeBuilder):
|
||||||
custEnv = lumiEnv.Clone()
|
custEnv = lumiEnv.Clone()
|
||||||
custEnv.Append( LINKFLAGS = "-Wl,-rpath=\\$$ORIGIN/$MODULES,--enable-new-dtags" )
|
custEnv.Append( LINKFLAGS = "-Wl,-rpath=\\$$ORIGIN/$MODULES,--enable-new-dtags" )
|
||||||
return custEnv
|
return custEnv
|
||||||
|
|
||||||
|
def getBuildDestination(self, lumiEnv): return lumiEnv.path.buildExe
|
||||||
|
def getInstallDestination(self, lumiEnv): return lumiEnv.path.installExe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
||||||
|
|
@ -219,6 +248,9 @@ class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
||||||
custEnv.Append(LINKFLAGS = "-Wl,-soname="+self.defineSoname(target,**kw))
|
custEnv.Append(LINKFLAGS = "-Wl,-soname="+self.defineSoname(target,**kw))
|
||||||
return custEnv
|
return custEnv
|
||||||
|
|
||||||
|
def getBuildDestination(self, lumiEnv): return lumiEnv.path.buildLib
|
||||||
|
def getInstallDestination(self, lumiEnv): return lumiEnv.path.installLib
|
||||||
|
|
||||||
|
|
||||||
def defineSoname (self, target, **kw):
|
def defineSoname (self, target, **kw):
|
||||||
""" internal helper to extract or guess
|
""" internal helper to extract or guess
|
||||||
|
|
@ -246,21 +278,33 @@ class LumieraModuleBuilder(WrappedStandardExeBuilder):
|
||||||
return soname
|
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):
|
def register_LumieraCustomBuilders (lumiEnv):
|
||||||
""" install the customised builder versions tightly integrated with our buildsystem.
|
""" install the customised builder versions tightly integrated with our buildsystem.
|
||||||
Especially, these builders automatically add the build and installation locations
|
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
|
and set the RPATH and SONAME in a way to allow a relocatable Lumiera directory structure
|
||||||
"""
|
"""
|
||||||
programBuilder = lumiEnv['BUILDERS']['Program']
|
programBuilder = LumieraExeBuilder (lumiEnv['BUILDERS']['Program'])
|
||||||
libraryBuilder = lumiEnv['BUILDERS']['SharedLibrary']
|
libraryBuilder = LumieraModuleBuilder (lumiEnv['BUILDERS']['SharedLibrary'])
|
||||||
smoduleBuilder = lumiEnv['BUILDERS']['LoadableModule']
|
smoduleBuilder = LumieraModuleBuilder (lumiEnv['BUILDERS']['LoadableModule'])
|
||||||
|
lpluginBuilder = LumieraPluginBuilder (lumiEnv['BUILDERS']['LoadableModule'])
|
||||||
|
|
||||||
programBuilder = LumieraExeBuilder (programBuilder)
|
lumiEnv['BUILDERS']['Program'] = programBuilder
|
||||||
libraryBuilder = LumieraModuleBuilder (libraryBuilder)
|
lumiEnv['BUILDERS']['SharedLibrary'] = libraryBuilder
|
||||||
smoduleBuilder = LumieraModuleBuilder (smoduleBuilder)
|
lumiEnv['BUILDERS']['LoadableModule'] = smoduleBuilder
|
||||||
lpluginBuilder = LumieraModuleBuilder (smoduleBuilder)
|
|
||||||
|
|
||||||
lumiEnv['BUILDERS']['Program'] = programBuilder
lumiEnv['BUILDERS']['SharedLibrary'] = libraryBuilder
lumiEnv['BUILDERS']['LoadableModule'] = smoduleBuilder
|
|
||||||
lumiEnv['BUILDERS']['LumieraPlugin'] = lpluginBuilder
|
lumiEnv['BUILDERS']['LumieraPlugin'] = lpluginBuilder
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -12,12 +12,12 @@ envSvg.mergeConf(['librsvg-2.0'])
|
||||||
envSvg.Append(LIBS=support_lib)
|
envSvg.Append(LIBS=support_lib)
|
||||||
|
|
||||||
|
|
||||||
luidgen = env.Program('#$TARGDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for generating Lumiera-UIDs
|
#luidgen = env.Program('luidgen', 'luidgen.c', LIBS=support_lib, install=True) ## for generating Lumiera-UIDs
|
||||||
rsvg = envSvg.Program('#$TARGDIR/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('#$TARGDIR/hello-world','hello.c') #### hello world (checks C build)
|
artifacts['tools'] = [ env.Program('hello-world','hello.c', install=True) #### hello world (checks C build)
|
||||||
+ env.Program('#$TARGDIR/try', 'try.cpp') #### to try out some feature...
|
+ env.Program('try', 'try.cpp') #### to try out some feature...
|
||||||
# + luidgen
|
# + luidgen
|
||||||
+ rsvg
|
+ 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
|
obj = srcSubtree(env,tree, isShared=False) # use all sourcefiles found in subtree
|
||||||
if not exeName:
|
if not exeName:
|
||||||
exeName = 'test-%s' % tree
|
exeName = 'test-%s' % tree
|
||||||
return env.Program('#$TARGDIR/'+exeName, obj + core)
|
return env.Program(exeName, obj + core)
|
||||||
|
|
||||||
|
|
||||||
def testCollection(env,dir):
|
def testCollection(env,dir):
|
||||||
|
|
@ -44,7 +44,7 @@ def testCollection(env,dir):
|
||||||
"""
|
"""
|
||||||
srcpatt = ['test-*.c']
|
srcpatt = ['test-*.c']
|
||||||
exeName = lambda p: path.basename(path.splitext(p)[0])
|
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)]
|
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
|
# 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]
|
artifacts['tools'] += [vgsuppr]
|
||||||
Depends(ts,vgsuppr)
|
Depends(ts,vgsuppr)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue