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; -*- |
| 2 | import os |
| 3 | |
Alexander Afanasyev | ef1e276 | 2015-08-31 13:18:35 -0700 | [diff] [blame^] | 4 | VERSION='0.2' |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 5 | APPNAME='ndn-tools' |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 6 | |
| 7 | def options(opt): |
| 8 | opt.load(['compiler_cxx', 'gnu_dirs']) |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 9 | |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 10 | opt.load(['default-compiler-flags', 'sphinx_build', 'boost'], tooldir=['.waf-tools']) |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 11 | opt.add_option('--with-tests', action='store_true', default=False, |
| 12 | dest='with_tests', help='''Build unit tests''') |
Shock Jiang | 0f0bc4b | 2015-06-22 15:11:30 -0700 | [diff] [blame] | 13 | opt.recurse("tools") |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 14 | |
| 15 | def configure(conf): |
| 16 | conf.load(['compiler_cxx', 'gnu_dirs', |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 17 | 'default-compiler-flags', 'sphinx_build', 'boost']) |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 18 | |
| 19 | if not os.environ.has_key('PKG_CONFIG_PATH'): |
| 20 | os.environ['PKG_CONFIG_PATH'] = ':'.join([ |
| 21 | '/usr/lib/pkgconfig', |
| 22 | '/usr/local/lib/pkgconfig', |
| 23 | '/opt/local/lib/pkgconfig']) |
| 24 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 25 | uselib_store='NDN_CXX', mandatory=True) |
| 26 | |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 27 | boost_libs = 'system iostreams regex' |
| 28 | if conf.options.with_tests: |
| 29 | conf.env['WITH_TESTS'] = 1 |
| 30 | conf.define('WITH_TESTS', 1); |
| 31 | boost_libs += ' unit_test_framework' |
| 32 | conf.check_boost(lib=boost_libs) |
Junxiao Shi | 2222a61 | 2015-06-06 08:01:38 -0700 | [diff] [blame] | 33 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 34 | conf.recurse('tools') |
| 35 | |
| 36 | def build(bld): |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 37 | bld.env['VERSION'] = VERSION |
| 38 | |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 39 | bld( |
| 40 | target='core-objects', |
| 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', |
Junxiao Shi | f719124 | 2015-03-19 05:53:41 -0700 | [diff] [blame] | 45 | export_includes='.', |
| 46 | ) |
| 47 | |
| 48 | bld.recurse('tools') |
Junxiao Shi | 2713a3b | 2015-06-22 16:19:05 -0700 | [diff] [blame] | 49 | bld.recurse('tests') |
Junxiao Shi | 2219a05 | 2015-05-28 02:53:48 -0700 | [diff] [blame] | 50 | bld.recurse('manpages') |