aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-17 06:33:45 +0000
committerDavid Robillard <d@drobilla.net>2011-09-17 06:33:45 +0000
commit3f3b0c4087b7125d1ddb62c2a0c455346a038094 (patch)
treec86327face67b6a4e896f49157d00c289e913fe6 /wscript
parenta15dc730bd895f5a52ad3dd9cae29e10e6d761ef (diff)
downloadserd-3f3b0c4087b7125d1ddb62c2a0c455346a038094.tar.gz
serd-3f3b0c4087b7125d1ddb62c2a0c455346a038094.tar.bz2
serd-3f3b0c4087b7125d1ddb62c2a0c455346a038094.zip
Add ability to build static library.
git-svn-id: http://svn.drobilla.net/serd/trunk@216 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'wscript')
-rw-r--r--wscript35
1 files changed, 25 insertions, 10 deletions
diff --git a/wscript b/wscript
index 7f72601b..d7d064e5 100644
--- a/wscript
+++ b/wscript
@@ -31,11 +31,13 @@ def options(opt):
autowaf.set_options(opt)
opt.load('compiler_c')
opt.add_option('--no-utils', action='store_true', default=False, dest='no_utils',
- help="Do not build command line utilities")
+ help="Do not build command line utilities")
opt.add_option('--test', action='store_true', default=False, dest='build_tests',
- help="Build unit tests")
+ help="Build unit tests")
opt.add_option('--stack-check', action='store_true', default=False, dest='stack_check',
- help="Include runtime stack sanity checks")
+ help="Include runtime stack sanity checks")
+ opt.add_option('--static', action='store_true', default=False, dest='static',
+ help="Build static library")
def configure(conf):
autowaf.configure(conf)
@@ -47,6 +49,7 @@ def configure(conf):
conf.env['BUILD_TESTS'] = Options.options.build_tests
conf.env['BUILD_UTILS'] = not Options.options.no_utils
+ conf.env['BUILD_STATIC'] = Options.options.static
if Options.options.stack_check:
autowaf.define(conf, 'SERD_STACK_CHECK', SERD_VERSION)
@@ -81,7 +84,7 @@ def build(bld):
src/writer.c
'''
- # Library
+ # Shared Library
obj = bld(features = 'c cshlib')
obj.export_includes = ['.']
obj.source = lib_source
@@ -92,21 +95,33 @@ def build(bld):
obj.install_path = '${LIBDIR}'
obj.cflags = [ '-fvisibility=hidden', '-DSERD_SHARED', '-DSERD_INTERNAL' ]
+ # Static library
+ if bld.env['BUILD_STATIC']:
+ obj = bld(features = 'c cstlib')
+ obj.export_includes = ['.']
+ obj.source = lib_source
+ obj.includes = ['.', './src']
+ obj.name = 'libserd_static'
+ obj.target = 'serd-%s' % SERD_MAJOR_VERSION
+ obj.vnum = SERD_LIB_VERSION
+ obj.install_path = '${LIBDIR}'
+ obj.cflags = [ '-DSERD_INTERNAL' ]
+
if bld.env['BUILD_TESTS']:
# Static library (for unit test code coverage)
obj = bld(features = 'c cstlib')
obj.source = lib_source
obj.includes = ['.', './src']
- obj.name = 'libserd_static'
- obj.target = 'serd_static'
+ obj.name = 'libserd_profiled'
+ obj.target = 'serd_profiled'
obj.install_path = ''
- obj.cflags = [ '-fprofile-arcs', '-ftest-coverage' ]
+ obj.cflags = [ '-fprofile-arcs', '-ftest-coverage', '-DSERD_INTERNAL' ]
# Unit test program
obj = bld(features = 'c cprogram')
obj.source = 'src/serdi.c'
obj.includes = ['.', './src']
- obj.use = 'libserd_static'
+ obj.use = 'libserd_profiled'
obj.linkflags = '-lgcov'
obj.target = 'serdi_static'
obj.install_path = ''
@@ -166,7 +181,7 @@ def build_dir(ctx, subdir):
return os.path.join('build', APPNAME, subdir)
else:
return os.path.join('build', subdir)
-
+
def fix_docs(ctx):
try:
top = os.getcwd()
@@ -273,7 +288,7 @@ def test(ctx):
'%s -o turtle -p foo %s/%s \'%s\' | %s -i turtle -c foo - \'%s\' | sed \'s/_:docid/_:genid/g\' > %s.thru' % (
'serdi_static', srcdir, test, base_uri,
'serdi_static', base_uri, test) ]
-
+
autowaf.run_tests(ctx, APPNAME, commands, 0, name='turtle-round-trip')
Logs.pprint('BOLD', '\nVerifying ntriples => turtle => ntriples')
for test in thru_tests: