aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'wscript')
-rw-r--r--wscript35
1 files changed, 31 insertions, 4 deletions
diff --git a/wscript b/wscript
index cb97c54..35c8fea 100644
--- a/wscript
+++ b/wscript
@@ -41,6 +41,7 @@ spec_map = {
def options(ctx):
ctx.load('compiler_c')
+ ctx.load('compiler_cxx')
ctx.load('lv2')
ctx.add_flags(
ctx.configuration_options(),
@@ -60,6 +61,11 @@ def configure(conf):
if Options.options.online_docs:
Options.options.docs = True
+ try:
+ conf.load('compiler_cxx', cache=True)
+ except:
+ pass
+
conf.load('lv2', cache=True)
conf.load('autowaf', cache=True)
autowaf.set_c_lang(conf, 'c99')
@@ -216,7 +222,7 @@ def build_spec(bld, path):
old_include_dir = os.path.join(bld.env.INCLUDEDIR, spec_map[name])
# Build test program if applicable
- for test in bld.path.ant_glob(os.path.join(path, '*-test.c')):
+ for test in bld.path.ant_glob(os.path.join(path, '*-test.c*')):
test_lib = []
test_cflags = ['']
test_linkflags = ['']
@@ -225,15 +231,25 @@ def build_spec(bld, path):
test_cflags += ['--coverage']
test_linkflags += ['--coverage']
- # Unit test program
+ # C Unit test program
bld(features = 'c cprogram',
- source = test,
+ source = path + '/%s-test.c' % name,
lib = test_lib,
- target = os.path.splitext(str(test.get_bld()))[0],
+ target = path + '/%s-test' % name,
install_path = None,
cflags = test_cflags,
linkflags = test_linkflags)
+ # C++ unit test program
+ if bld.path.find_node(path + '/%s-test.cpp' % name):
+ bld(features = 'cxx cxxprogram',
+ source = path + '/%s-test.cpp' % name,
+ lib = test_lib,
+ target = path + '/%s-cpp-test' % name,
+ install_path = None,
+ cflags = test_cflags,
+ linkflags = test_linkflags)
+
# Install bundle
bld.install_files(bundle_dir,
bld.path.ant_glob(path + '/?*.*', excl='*.in'))
@@ -411,6 +427,17 @@ def build(bld):
target = 'build-test',
install_path = None)
+ if 'COMPILER_CXX' in bld.env:
+ bld(rule = gen_build_test,
+ source = bld.path.ant_glob('lv2/**/*.h*'),
+ target = 'build-test.cpp',
+ install_path = None)
+
+ bld(features = 'cxx cxxprogram',
+ source = bld.path.get_bld().make_node('build-test.cpp'),
+ target = 'build-test-cpp',
+ install_path = None)
+
if bld.env.BUILD_BOOK:
# Build "Programming LV2 Plugins" book from plugin examples
bld.recurse('plugins')