From 86826ae6733119d462be9f3642161db895756643 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jan 2012 21:12:48 +0000 Subject: Full test coverage for ZixRing. Update waf. git-svn-id: http://svn.drobilla.net/zix/trunk@50 df6676b4-ccc9-40e5-b5d6-7c4628a128e3 --- wscript | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index 7c86b4c..965426d 100644 --- a/wscript +++ b/wscript @@ -9,7 +9,8 @@ from waflib.extras import autowaf as autowaf import waflib.Logs as Logs, waflib.Options as Options # Version of this package (even if built as a child) -ZIX_VERSION = '0.0.2' +ZIX_VERSION = '0.0.2' +ZIX_MAJOR_VERSION = '0' # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -41,14 +42,21 @@ def configure(conf): conf.load('compiler_c') conf.env.append_value('CFLAGS', '-std=c99') + conf.env['BUILD_BENCH'] = Options.options.build_bench + conf.env['BUILD_TESTS'] = Options.options.build_tests + # Check for mlock conf.check(function_name='mlock', header_name='sys/mman.h', define_name='HAVE_MLOCK', mandatory=False) - conf.env['BUILD_BENCH'] = Options.options.build_bench - conf.env['BUILD_TESTS'] = Options.options.build_tests + # Check for gcov library (for test coverage) + if conf.env['BUILD_TESTS']: + conf.check_cc(lib='gcov', + define_name='HAVE_GCOV', + mandatory=False) + if Options.options.build_bench: autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.0.0', mandatory=False) @@ -77,7 +85,8 @@ def build(bld): bld.install_files('${INCLUDEDIR}/zix', bld.path.ant_glob('zix/*.h')) # Pkgconfig file - autowaf.build_pc(bld, 'ZIX', ZIX_VERSION, []) + autowaf.build_pc(bld, 'ZIX', ZIX_VERSION, ZIX_MAJOR_VERSION, [], + {'ZIX_MAJOR_VERSION' : ZIX_MAJOR_VERSION}) framework = '' if Options.platform == 'darwin': @@ -108,27 +117,34 @@ def build(bld): '-DZIX_INTERNAL' ]) if bld.env['BUILD_TESTS']: + test_libs = ['pthread'] + test_cflags = [] + if bld.is_defined('HAVE_GCOV'): + test_libs += ['gcov'] + test_cflags += ['-fprofile-arcs', '-ftest-coverage'] + # Static library (for unit test code coverage) obj = bld(features = 'c cstlib', source = lib_source, includes = ['.', './src'], - name = 'libzix_static', - target = 'zix_static', + lib = test_libs, + name = 'libzix_profiled', + target = 'zix_profiled', install_path = '', framework = framework, - cflags = ['-fprofile-arcs', '-ftest-coverage']) + cflags = test_cflags + ['-DZIX_INTERNAL']) # Unit test programs for i in tests: obj = bld(features = 'c cprogram', source = 'test/%s.c' % i, includes = ['.'], - use = 'libzix_static', - linkflags = ['-lgcov', '-lpthread'], + use = 'libzix_profiled', + lib = test_libs, target = 'test/%s' % i, install_path = '', framework = framework, - cflags = ['-fprofile-arcs', '-ftest-coverage' ]) + cflags = test_cflags) if bld.env['BUILD_BENCH']: # Benchmark programs @@ -138,7 +154,7 @@ def build(bld): includes = ['.'], use = 'libzix', uselib = 'GLIB', - linkflags = '-lrt', + lib = ['rt'], target = 'test/%s' % i, framework = framework, install_path = '') -- cgit v1.2.1