summaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-31 21:12:48 +0000
committerDavid Robillard <d@drobilla.net>2012-01-31 21:12:48 +0000
commit86826ae6733119d462be9f3642161db895756643 (patch)
tree27edf411aeecde4d96c01f1305e8764da963d84b /wscript
parent790aa117d1bd1c012c6982d1c6bd0832eb9d6118 (diff)
downloadzix-86826ae6733119d462be9f3642161db895756643.tar.gz
zix-86826ae6733119d462be9f3642161db895756643.tar.bz2
zix-86826ae6733119d462be9f3642161db895756643.zip
Full test coverage for ZixRing.
Update waf. git-svn-id: http://svn.drobilla.net/zix/trunk@50 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
Diffstat (limited to 'wscript')
-rw-r--r--wscript38
1 files changed, 27 insertions, 11 deletions
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 = '')