From 3f3b0c4087b7125d1ddb62c2a0c455346a038094 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 17 Sep 2011 06:33:45 +0000 Subject: Add ability to build static library. git-svn-id: http://svn.drobilla.net/serd/trunk@216 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- ChangeLog | 3 ++- waf | Bin 89303 -> 89530 bytes wscript | 35 +++++++++++++++++++++++++---------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a703d6e5..9c5b26c8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,8 @@ serd (UNRELEASED) unstable; urgency=low * Avoid writing illegal Turtle names as a result of URI qualifying * Gracefully handle NULL reader sinks * Add serd_strerror - * Fix erroneously equal SERD_ERR_BAD_SYNTAX and SERD_ERR_BAD_ARG. + * Fix erroneously equal SERD_ERR_BAD_SYNTAX and SERD_ERR_BAD_ARG + * Add ability to build static library -- David Robillard (UNRELEASED) diff --git a/waf b/waf index bea9f520..c97be3ec 100755 Binary files a/waf and b/waf differ 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: -- cgit v1.2.1