Build most of Lumiera as shared library (SCons build)
This commit is contained in:
parent
255e501258
commit
12fc97b8e2
3 changed files with 24 additions and 18 deletions
24
SConstruct
24
SConstruct
|
|
@ -27,6 +27,7 @@ OPTIONSCACHEFILE = 'optcache'
|
||||||
CUSTOPTIONSFILE = 'custom-options'
|
CUSTOPTIONSFILE = 'custom-options'
|
||||||
SRCDIR = 'src'
|
SRCDIR = 'src'
|
||||||
BINDIR = 'bin'
|
BINDIR = 'bin'
|
||||||
|
LIBDIR = 'bin/.libs'
|
||||||
TESTDIR = 'tests'
|
TESTDIR = 'tests'
|
||||||
ICONDIR = 'icons'
|
ICONDIR = 'icons'
|
||||||
VERSION = '0.1+pre.01'
|
VERSION = '0.1+pre.01'
|
||||||
|
|
@ -65,14 +66,17 @@ def setupBasicEnvironment():
|
||||||
)
|
)
|
||||||
handleVerboseMessages(env)
|
handleVerboseMessages(env)
|
||||||
|
|
||||||
env.Append ( CCCOM=' -std=gnu99') # workaround for a bug: CCCOM currently doesn't honor CFLAGS, only CCFLAGS
|
env.Append ( CCCOM=' -std=gnu99')
|
||||||
|
env.Append ( SHCCCOM=' -std=gnu99') # workaround for a bug: CCCOM currently doesn't honour CFLAGS, only CCFLAGS
|
||||||
env.Replace( VERSION=VERSION
|
env.Replace( VERSION=VERSION
|
||||||
, SRCDIR=SRCDIR
|
, SRCDIR=SRCDIR
|
||||||
, BINDIR=BINDIR
|
, BINDIR=BINDIR
|
||||||
|
, LIBDIR=LIBDIR
|
||||||
, ICONDIR=ICONDIR
|
, ICONDIR=ICONDIR
|
||||||
, CPPPATH=["#"+SRCDIR] # used to find includes, "#" means always absolute to build-root
|
, 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
|
, CPPDEFINES=['-DLUMIERA_VERSION='+VERSION ] # note: it's a list to append further defines
|
||||||
, CCFLAGS='-Wall ' # -fdiagnostics-show-option
|
, CCFLAGS='-Wall ' # -fdiagnostics-show-option
|
||||||
|
, CFLAGS='-std=gnu99'
|
||||||
)
|
)
|
||||||
RegisterIcon_Builder(env,SVGRENDERER)
|
RegisterIcon_Builder(env,SVGRENDERER)
|
||||||
handleNoBugSwitches(env)
|
handleNoBugSwitches(env)
|
||||||
|
|
@ -123,10 +127,10 @@ def handleVerboseMessages(env):
|
||||||
""" toggle verbose build output """
|
""" toggle verbose build output """
|
||||||
if not env['VERBOSE']:
|
if not env['VERBOSE']:
|
||||||
# SetOption('silent', True)
|
# SetOption('silent', True)
|
||||||
env['CCCOMSTR'] = " Compiling $SOURCE"
|
env['CCCOMSTR'] = env['SHCCCOMSTR'] = " Compiling $SOURCE"
|
||||||
env['CXXCOMSTR'] = " Compiling++ $SOURCE"
|
env['CXXCOMSTR'] = env['SHCXXCOMSTR'] = " Compiling++ $SOURCE"
|
||||||
env['LINKCOMSTR'] = " Linking --> $TARGET"
|
env['LINKCOMSTR'] = " Linking --> $TARGET"
|
||||||
env['LDMODULECOMSTR'] = " creating module [ $TARGET ]"
|
env['LDMODULECOMSTR'] = " creating module [ $TARGET ]"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -313,12 +317,13 @@ def defineBuildTargets(env, artifacts):
|
||||||
+ srcSubtree(env,'$SRCDIR/common')
|
+ srcSubtree(env,'$SRCDIR/common')
|
||||||
+ srcSubtree(env,'$SRCDIR/lib')
|
+ srcSubtree(env,'$SRCDIR/lib')
|
||||||
)
|
)
|
||||||
core = ( env.StaticLibrary('$BINDIR/lumiback.la', objback)
|
core = ( env.SharedLibrary('$LIBDIR/lumiback', objback)
|
||||||
+ env.StaticLibrary('$BINDIR/lumiproc.la', objproc)
|
+ env.SharedLibrary('$LIBDIR/lumiproc', objproc)
|
||||||
+ env.StaticLibrary('$BINDIR/lumiera.la', objlib)
|
+ env.SharedLibrary('$LIBDIR/lumiera', objlib)
|
||||||
)
|
)
|
||||||
|
|
||||||
artifacts['lumiera'] = env.Program('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp']+ core )
|
artifacts['lumiera'] = env.Program('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp']+ core )
|
||||||
|
artifacts['corelib'] = core
|
||||||
|
|
||||||
# temporary solution to build the GuiStarterPlugin (TODO: implement plugin building as discussed on November meeting)
|
# temporary solution to build the GuiStarterPlugin (TODO: implement plugin building as discussed on November meeting)
|
||||||
envplug = env.Clone()
|
envplug = env.Clone()
|
||||||
|
|
@ -375,6 +380,7 @@ def defineInstallTargets(env, artifacts):
|
||||||
""" define some artifacts to be installed into target locations.
|
""" define some artifacts to be installed into target locations.
|
||||||
"""
|
"""
|
||||||
env.Install(dir = '$DESTDIR/bin', source=artifacts['lumiera'])
|
env.Install(dir = '$DESTDIR/bin', source=artifacts['lumiera'])
|
||||||
|
env.Install(dir = '$DESTDIR/lib', source=artifacts['corelib'])
|
||||||
env.Install(dir = '$DESTDIR/lib', source=artifacts['plugins'])
|
env.Install(dir = '$DESTDIR/lib', source=artifacts['plugins'])
|
||||||
env.Install(dir = '$DESTDIR/bin', source=artifacts['tools'])
|
env.Install(dir = '$DESTDIR/bin', source=artifacts['tools'])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ def isCleanupOperation(env):
|
||||||
|
|
||||||
def isHelpRequest():
|
def isHelpRequest():
|
||||||
""" this is a hack: SCons does all configure tests even if only
|
""" this is a hack: SCons does all configure tests even if only
|
||||||
the helpmessage is requested. SCons doesn't export the
|
the help message is requested. SCons doesn't export the
|
||||||
help option for retrieval by env.GetOption(),
|
help option for retrieval by env.GetOption(),
|
||||||
so we scan the commandline directly.
|
so we scan the commandline directly.
|
||||||
"""
|
"""
|
||||||
|
|
@ -48,8 +48,8 @@ def isHelpRequest():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def srcSubtree(env,tree,isShared=False,builder=None, **args):
|
def srcSubtree(env,tree,isShared=True,builder=None, **args):
|
||||||
""" convienience wrapper: scans the given subtree, which is
|
""" convenience wrapper: scans the given subtree, which is
|
||||||
relative to the current SConscript, find all source files and
|
relative to the current SConscript, find all source files and
|
||||||
declare them as Static or SharedObjects for compilation
|
declare them as Static or SharedObjects for compilation
|
||||||
"""
|
"""
|
||||||
|
|
@ -68,7 +68,7 @@ SRCPATTERNS = ['*.c','*.cpp','*.cc']
|
||||||
|
|
||||||
def scanSubtree(roots, patterns=SRCPATTERNS):
|
def scanSubtree(roots, patterns=SRCPATTERNS):
|
||||||
""" first expand (possible) wildcards and filter out non-dirs.
|
""" first expand (possible) wildcards and filter out non-dirs.
|
||||||
Then scan the given subtree for source filesnames
|
Then scan the given subtree for source filenames
|
||||||
(python generator function)
|
(python generator function)
|
||||||
"""
|
"""
|
||||||
for root in globRootdirs(roots):
|
for root in globRootdirs(roots):
|
||||||
|
|
@ -116,7 +116,7 @@ def getDirname(dir):
|
||||||
|
|
||||||
|
|
||||||
def RegisterIcon_Builder(env, renderer):
|
def RegisterIcon_Builder(env, renderer):
|
||||||
""" Registeres Custom Builders for generating and installing Icons.
|
""" Registers Custom Builders for generating and installing Icons.
|
||||||
Additionally you need to build the tool (rsvg-convert.c)
|
Additionally you need to build the tool (rsvg-convert.c)
|
||||||
used to generate png from the svg source using librsvg.
|
used to generate png from the svg source using librsvg.
|
||||||
"""
|
"""
|
||||||
|
|
@ -157,7 +157,7 @@ def Tarball(env,location,dirs,suffix=''):
|
||||||
suffix: (optional) suffix to include in the tar name
|
suffix: (optional) suffix to include in the tar name
|
||||||
dirs: directories to include in the tar
|
dirs: directories to include in the tar
|
||||||
|
|
||||||
This is a bit of a hack, because we want to be able to include arbitrary dirctories,
|
This is a bit of a hack, because we want to be able to include arbitrary directories,
|
||||||
without creating new dependencies on those dirs. Esp. we want to tar the source tree
|
without creating new dependencies on those dirs. Esp. we want to tar the source tree
|
||||||
prior to compiling. Solution is
|
prior to compiling. Solution is
|
||||||
- use the Command-Builder, but pass all target specifications as custom build vars
|
- use the Command-Builder, but pass all target specifications as custom build vars
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ def testExecutable(env,tree, exeName=None, obj=None):
|
||||||
if obj:
|
if obj:
|
||||||
obj = [path.join(tree,name) for name in obj]
|
obj = [path.join(tree,name) for name in obj]
|
||||||
else:
|
else:
|
||||||
obj = srcSubtree(env,tree) # 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('#$BINDIR/'+exeName, obj + core)
|
return env.Program('#$BINDIR/'+exeName, obj + core)
|
||||||
|
|
@ -52,8 +52,8 @@ def treatPluginTestcase(env):
|
||||||
prfx = path.join(tree,'example_plugin')
|
prfx = path.join(tree,'example_plugin')
|
||||||
oC = env.SharedObject(prfx, prfx+'.c')
|
oC = env.SharedObject(prfx, prfx+'.c')
|
||||||
oCPP = env.SharedObject(prfx+'_cpp', prfx+'.cpp')
|
oCPP = env.SharedObject(prfx+'_cpp', prfx+'.cpp')
|
||||||
testplugin = ( env.LoadableModule('#$BINDIR/.libs/examplepluginc', oC, SHLIBPREFIX='')
|
testplugin = ( env.LoadableModule('#$LIBDIR/examplepluginc', oC, SHLIBPREFIX='')
|
||||||
# + env.SharedLibrary('#$BINDIR/.libs/exampleplugincpp', oCPP, SHLIBPREFIX='')
|
# + env.SharedLibrary('#$LIBDIR/exampleplugincpp', oCPP, SHLIBPREFIX='')
|
||||||
# doesn't compile yet...
|
# doesn't compile yet...
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue