summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-01-16 01:41:21 +0000
committerDavid Robillard <d@drobilla.net>2012-01-16 01:41:21 +0000
commitd67768c62c752d11f473bcb0c449e95044984ce7 (patch)
tree61ab5f6d9f369de35abc29f9ad0681d8c6ee7656
parente400713f08dde9c8e22194dc663162603377b3a9 (diff)
downloadsord-d67768c62c752d11f473bcb0c449e95044984ce7.tar.gz
sord-d67768c62c752d11f473bcb0c449e95044984ce7.tar.bz2
sord-d67768c62c752d11f473bcb0c449e95044984ce7.zip
Fix test suite compilation without gcov.
git-svn-id: http://svn.drobilla.net/sord/trunk@188 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r--wscript20
1 files changed, 15 insertions, 5 deletions
diff --git a/wscript b/wscript
index 5c8fb8d..9bbee17 100644
--- a/wscript
+++ b/wscript
@@ -52,6 +52,12 @@ def configure(conf):
conf.env['BUILD_UTILS'] = True
conf.env['BUILD_STATIC'] = Options.options.static
+ # Check for gcov library (for test coverage)
+ if conf.env['BUILD_TESTS']:
+ conf.check_cc(lib='gcov',
+ define_name='HAVE_GCOV',
+ mandatory=False)
+
dump = Options.options.dump.split(',')
all = 'all' in dump
if all or 'iter' in dump:
@@ -130,7 +136,11 @@ def build(bld):
autowaf.use_lib(bld, obj, 'SERD')
if bld.env['BUILD_TESTS']:
- test_cflags = [ '-fprofile-arcs', '-ftest-coverage' ]
+ test_libs = ['m']
+ test_cflags = ['']
+ if bld.is_defined('HAVE_GCOV'):
+ test_libs += ['gcov']
+ test_cflags += ['-fprofile-arcs', '-ftest-coverage']
# Static profiled library (for unit test code coverage)
obj = bld(features = 'c cstlib',
@@ -140,7 +150,7 @@ def build(bld):
target = 'sord_profiled',
install_path = '',
cflags = test_cflags,
- libs = [ 'm' ])
+ lib = test_libs)
autowaf.use_lib(bld, obj, 'SERD')
# Unit test program
@@ -148,7 +158,7 @@ def build(bld):
source = 'src/sord_test.c',
includes = ['.', './src'],
use = 'libsord_profiled',
- lib = ['gcov'],
+ lib = test_libs,
target = 'sord_test',
install_path = '',
cflags = test_cflags)
@@ -159,7 +169,7 @@ def build(bld):
source = 'src/sordi.c',
includes = ['.', './src'],
use = 'libsord_profiled',
- lib = ['gcov'],
+ lib = test_libs,
target = 'sordi_static',
install_path = '',
cflags = [ '-fprofile-arcs', '-ftest-coverage' ])
@@ -170,7 +180,7 @@ def build(bld):
source = 'src/sordmm_test.cpp',
includes = ['.', './src'],
use = 'libsord_profiled',
- lib = ['gcov'],
+ lib = test_libs,
target = 'sordmm_test',
install_path = '',
cflags = test_cflags)