shockjiang | e9c1ab9 | 2014-07-21 12:02:52 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | VERSION='0.1' |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 3 | APPNAME="ndns" |
shockjiang | e9c1ab9 | 2014-07-21 12:02:52 -0700 | [diff] [blame] | 4 | |
| 5 | def options(opt): |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 6 | opt.load(['compiler_cxx', 'gnu_dirs']) |
| 7 | opt.load(['boost', 'default-compiler-flags', 'doxygen', 'sphinx_build', |
| 8 | 'sqlite3', 'pch', 'coverage'], tooldir=['.waf-tools']) |
| 9 | |
| 10 | ropt = opt.add_option_group('NDNS Options') |
| 11 | |
| 12 | ropt.add_option('--with-tests', action='store_true', default=False, dest='with_tests', |
| 13 | help='''build unit tests''') |
shockjiang | e9c1ab9 | 2014-07-21 12:02:52 -0700 | [diff] [blame] | 14 | |
| 15 | def configure(conf): |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 16 | conf.load(['compiler_cxx', 'gnu_dirs', |
| 17 | 'boost', 'default-compiler-flags', 'doxygen', |
| 18 | 'sqlite3', 'pch', 'coverage']) |
| 19 | |
shockjiang | e9c1ab9 | 2014-07-21 12:02:52 -0700 | [diff] [blame] | 20 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 21 | uselib_store='NDN_CXX', mandatory=True) |
| 22 | |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 23 | conf.check_sqlite3(mandatory=True) |
| 24 | |
| 25 | if conf.options.with_tests: |
| 26 | conf.env['WITH_TESTS'] = True |
| 27 | |
| 28 | USED_BOOST_LIBS = ['system'] |
| 29 | if conf.env['WITH_TESTS']: |
| 30 | USED_BOOST_LIBS += ['unit_test_framework'] |
| 31 | conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True) |
| 32 | |
| 33 | # conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/ndns.conf' % conf.env['SYSCONFDIR']) |
| 34 | |
| 35 | if not conf.options.with_sqlite_locking: |
| 36 | conf.define('DISABLE_SQLITE3_FS_LOCKING', 1) |
| 37 | |
| 38 | conf.write_config_header('src/config.hpp') |
| 39 | |
shockjiang | e9c1ab9 | 2014-07-21 12:02:52 -0700 | [diff] [blame] | 40 | def build (bld): |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 41 | bld( |
| 42 | features='cxx', |
| 43 | name='ndns-objects', |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame^] | 44 | # source=bld.path.ant_glob(['src/**/*.cpp'], excl=['src/main.cpp']), |
| 45 | source=bld.path.ant_glob(['src/rr.cpp', 'src/query.cpp', |
| 46 | 'src/response.cpp', 'src/zone.cpp', 'src/iterative-query.cpp', |
| 47 | 'src/db/db-mgr.cpp','src/db/zone-mgr.cpp', 'src/db/rr-mgr.cpp', |
| 48 | 'src/app/ndn-app.cpp', 'src/app/name-server.cpp', |
| 49 | 'src/app/name-caching-resolver.cpp', 'src/app/name-dig.cpp', |
| 50 | ], |
| 51 | excl=['src/main.cpp']), |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 52 | use='NDN_CXX BOOST', |
| 53 | includes='src', |
| 54 | export_includes='src', |
| 55 | ) |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame^] | 56 | |
| 57 | bld( |
| 58 | features='cxx cxxprogram', |
| 59 | source = "tools/name-server-daemon.cpp", |
| 60 | target = "name-server-daemon", |
| 61 | use = "ndns-objects" |
| 62 | ) |
| 63 | |
| 64 | bld( |
| 65 | features='cxx cxxprogram', |
| 66 | source = "tools/caching-resolver-daemon.cpp", |
| 67 | target = "caching-resolver-daemon", |
| 68 | use = "ndns-objects" |
| 69 | ) |
| 70 | |
| 71 | bld( |
| 72 | features='cxx cxxprogram', |
| 73 | source = "tools/dig.cpp", |
| 74 | target = "dig", |
| 75 | use = "ndns-objects" |
| 76 | ) |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
Alexander Afanasyev | 6e3d1ac | 2014-07-21 12:47:49 -0700 | [diff] [blame] | 82 | bld.recurse('tests') |
| 83 | |
| 84 | # bld.install_files('${SYSCONFDIR}/ndn', 'ndns.conf.sample') |