blob: 5a34e32b64e31e916a5e31a70105fe5b65e2ccd2 [file] [log] [blame]
Junxiao Shif7191242015-03-19 05:53:41 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Junxiao Shif7191242015-03-19 05:53:41 -07002
Davide Pesaventof0a301d2016-08-14 11:43:08 +02003VERSION = '0.3'
Alexander Afanasyev821a0142016-03-02 15:42:28 -08004APPNAME = 'ndn-tools'
5
6from waflib import Utils
7import os
Junxiao Shif7191242015-03-19 05:53:41 -07008
9def options(opt):
10 opt.load(['compiler_cxx', 'gnu_dirs'])
Davide Pesavento89d91752016-08-14 11:34:09 +020011 opt.load(['default-compiler-flags', 'sanitizers', 'sphinx_build', 'boost'],
12 tooldir=['.waf-tools'])
Shock Jiang0f0bc4b2015-06-22 15:11:30 -070013
Junxiao Shi2713a3b2015-06-22 16:19:05 -070014 opt.add_option('--with-tests', action='store_true', default=False,
15 dest='with_tests', help='''Build unit tests''')
Davide Pesavento89d91752016-08-14 11:34:09 +020016
17 opt.recurse('tools')
Junxiao Shif7191242015-03-19 05:53:41 -070018
19def configure(conf):
20 conf.load(['compiler_cxx', 'gnu_dirs',
Davide Pesavento89d91752016-08-14 11:34:09 +020021 'default-compiler-flags', 'sanitizers', 'sphinx_build', 'boost'])
Junxiao Shif7191242015-03-19 05:53:41 -070022
Alexander Afanasyev821a0142016-03-02 15:42:28 -080023 if 'PKG_CONFIG_PATH' not in os.environ:
24 os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
Junxiao Shif7191242015-03-19 05:53:41 -070025 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
26 uselib_store='NDN_CXX', mandatory=True)
27
Junxiao Shi2713a3b2015-06-22 16:19:05 -070028 boost_libs = 'system iostreams regex'
29 if conf.options.with_tests:
30 conf.env['WITH_TESTS'] = 1
31 conf.define('WITH_TESTS', 1);
32 boost_libs += ' unit_test_framework'
33 conf.check_boost(lib=boost_libs)
Junxiao Shi2222a612015-06-06 08:01:38 -070034
Junxiao Shif7191242015-03-19 05:53:41 -070035 conf.recurse('tools')
36
37def build(bld):
Junxiao Shi2219a052015-05-28 02:53:48 -070038 bld.env['VERSION'] = VERSION
39
Davide Pesavento89d91752016-08-14 11:34:09 +020040 bld(target='core-objects',
Junxiao Shif7191242015-03-19 05:53:41 -070041 name='core-objects',
42 features='cxx',
43 source=bld.path.ant_glob(['core/*.cpp']),
Junxiao Shi2713a3b2015-06-22 16:19:05 -070044 use='NDN_CXX BOOST',
Davide Pesavento89d91752016-08-14 11:34:09 +020045 export_includes='.')
Junxiao Shif7191242015-03-19 05:53:41 -070046
47 bld.recurse('tools')
Junxiao Shi2713a3b2015-06-22 16:19:05 -070048 bld.recurse('tests')
Junxiao Shi2219a052015-05-28 02:53:48 -070049 bld.recurse('manpages')