build: make examples optional
Change-Id: Ia57725bbe0e921c145f153c5395ed60436c8782a
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 20e6bd1..692ad2f 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -27,8 +27,8 @@
./waf --color=yes distclean
fi
-# Build in debug mode with tests
-./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
+# Build in debug mode with tests and examples
+./waf --color=yes configure --debug --with-tests --with-examples $ASAN $COVERAGE
./waf --color=yes build -j$WAF_JOBS
# (tests will be run against the debug version)
diff --git a/examples/wscript b/examples/wscript
index 2620281..e6badbf 100644
--- a/examples/wscript
+++ b/examples/wscript
@@ -3,23 +3,21 @@
top = '..'
def build(bld):
- # List all .cpp files (whole example should be in one .cpp)
- for example in bld.path.ant_glob(['*.cpp']):
- name = example.change_ext('').path_from(bld.path.get_bld())
- bld(features=['cxx', 'cxxprogram'],
- target=name,
- source=[example] + bld.path.ant_glob(['%s/**/*.cpp' % name]),
- use='NDN_CXX libndn-nac',
- install_path=None
- )
+ # List all .cpp files (whole example in one .cpp)
+ for ex in bld.path.ant_glob('*.cpp'):
+ name = ex.change_ext('').path_from(bld.path.get_bld())
+ bld.program(name='example-%s' % name,
+ target='nac-%s' % name,
+ source=[ex],
+ use='libndn-nac',
+ install_path=None)
- # List all directories files (example can has multiple .cpp in the directory)
- for name in bld.path.ant_glob(['*'], dir=True, src=False):
+ # List all directories (example can have multiple .cpp in the directory)
+ for subdir in bld.path.ant_glob('*', dir=True, src=False):
name = subdir.path_from(bld.path)
- bld(features=['cxx', 'cxxprogram'],
- target="%s/%s" % (name, name),
- source=bld.path.ant_glob(['%s/**/*.cpp' % name]),
- use='NDN_CXX libndn-nac',
- install_path=None,
- includes='%s' % name,
- )
+ bld.program(name='example-%s' % name,
+ target=name,
+ source=subdir.ant_glob('**/*.cpp'),
+ use='libndn-nac',
+ includes=name,
+ install_path=None)
diff --git a/tools/wscript b/tools/wscript
index ca28aa5..07de0e9 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -1,7 +1,5 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import Utils
-
top = '..'
def build(bld):
@@ -47,13 +45,3 @@
source=[],
export_includes='.',
use=testableObjects)
-
- # Tool wrappers
- wrapperFiles = bld.path.ant_glob('wrapper/*.sh')
- bld(name='wrappers',
- features='subst',
- source=wrapperFiles,
- target=['../bin/%s' % node.change_ext('', '.sh').path_from(bld.path.find_dir('wrapper').get_bld())
- for node in wrapperFiles],
- install_path='${BINDIR}',
- chmod=Utils.O755)
diff --git a/wscript b/wscript
index 6e49d2a..b2b21f9 100644
--- a/wscript
+++ b/wscript
@@ -10,11 +10,14 @@
def options(opt):
opt.load(['compiler_cxx', 'gnu_dirs'])
- opt.load(['default-compiler-flags', 'coverage', 'sanitizers',
- 'boost', 'doxygen', 'sphinx_build'],
+ opt.load(['default-compiler-flags',
+ 'coverage', 'sanitizers', 'boost',
+ 'doxygen', 'sphinx_build'],
tooldir=['.waf-tools'])
optgrp = opt.add_option_group('NDN-NAC Options')
+ optgrp.add_option('--with-examples', action='store_true', default=False,
+ help='Build examples')
optgrp.add_option('--with-tests', action='store_true', default=False,
help='Build unit tests')
@@ -23,7 +26,7 @@
'default-compiler-flags', 'boost',
'doxygen', 'sphinx_build'])
- conf.env.WITH_EXAMPLES = True
+ conf.env.WITH_EXAMPLES = conf.options.with_examples
conf.env.WITH_TESTS = conf.options.with_tests
conf.find_program('dot', var='DOT', mandatory=False)