Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 2 | |
Davide Pesavento | f0a301d | 2016-08-14 11:43:08 +0200 | [diff] [blame] | 3 | VERSION = '0.3' |
Alexander Afanasyev | 821a014 | 2016-03-02 15:42:28 -0800 | [diff] [blame] | 4 | APPNAME = 'ndn-tools' |
| 5 | |
| 6 | from waflib import Utils |
| 7 | import os |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 8 | |
| 9 | def options(opt): |
| 10 | opt.load(['compiler_cxx', 'gnu_dirs']) |
Davide Pesavento | 89d9175 | 2016-08-14 11:34:09 +0200 | [diff] [blame] | 11 | opt.load(['default-compiler-flags', 'sanitizers', 'sphinx_build', 'boost'], |
| 12 | tooldir=['.waf-tools']) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 13 | |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 14 | opt.add_option('--with-tests', action='store_true', default=False, |
| 15 | dest='with_tests', help='''Build unit tests''') |
Davide Pesavento | 89d9175 | 2016-08-14 11:34:09 +0200 | [diff] [blame] | 16 | |
| 17 | opt.recurse('tools') |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 18 | |
| 19 | def configure(conf): |
| 20 | conf.load(['compiler_cxx', 'gnu_dirs', |
Davide Pesavento | 89d9175 | 2016-08-14 11:34:09 +0200 | [diff] [blame] | 21 | 'default-compiler-flags', 'sanitizers', 'sphinx_build', 'boost']) |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | 821a014 | 2016-03-02 15:42:28 -0800 | [diff] [blame] | 23 | if 'PKG_CONFIG_PATH' not in os.environ: |
| 24 | os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env) |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 25 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 26 | uselib_store='NDN_CXX', mandatory=True) |
| 27 | |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 28 | 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 Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 34 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 35 | conf.recurse('tools') |
| 36 | |
| 37 | def build(bld): |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 38 | bld.env['VERSION'] = VERSION |
| 39 | |
Davide Pesavento | 89d9175 | 2016-08-14 11:34:09 +0200 | [diff] [blame] | 40 | bld(target='core-objects', |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 41 | name='core-objects', |
| 42 | features='cxx', |
| 43 | source=bld.path.ant_glob(['core/*.cpp']), |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 44 | use='NDN_CXX BOOST', |
Davide Pesavento | 89d9175 | 2016-08-14 11:34:09 +0200 | [diff] [blame] | 45 | export_includes='.') |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 46 | |
| 47 | bld.recurse('tools') |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 48 | bld.recurse('tests') |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 49 | bld.recurse('manpages') |