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 | |
Alexander Afanasyev | 821a014 | 2016-03-02 15:42:28 -0800 | [diff] [blame] | 3 | VERSION = '0.2' |
| 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']) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 11 | |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 12 | opt.load(['default-compiler-flags', 'sphinx_build', 'boost'], tooldir=['.waf-tools']) |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 13 | opt.add_option('--with-tests', action='store_true', default=False, |
| 14 | dest='with_tests', help='''Build unit tests''') |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 15 | opt.recurse("tools") |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 16 | |
| 17 | def configure(conf): |
| 18 | conf.load(['compiler_cxx', 'gnu_dirs', |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 19 | 'default-compiler-flags', 'sphinx_build', 'boost']) |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 20 | |
Alexander Afanasyev | 821a014 | 2016-03-02 15:42:28 -0800 | [diff] [blame] | 21 | if 'PKG_CONFIG_PATH' not in os.environ: |
| 22 | os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env) |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 23 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 24 | uselib_store='NDN_CXX', mandatory=True) |
| 25 | |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 26 | boost_libs = 'system iostreams regex' |
| 27 | if conf.options.with_tests: |
| 28 | conf.env['WITH_TESTS'] = 1 |
| 29 | conf.define('WITH_TESTS', 1); |
| 30 | boost_libs += ' unit_test_framework' |
| 31 | conf.check_boost(lib=boost_libs) |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 32 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 33 | conf.recurse('tools') |
| 34 | |
| 35 | def build(bld): |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 36 | bld.env['VERSION'] = VERSION |
| 37 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 38 | bld( |
| 39 | target='core-objects', |
| 40 | name='core-objects', |
| 41 | features='cxx', |
| 42 | source=bld.path.ant_glob(['core/*.cpp']), |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 43 | use='NDN_CXX BOOST', |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 44 | export_includes='.', |
| 45 | ) |
| 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') |