Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 2 | VERSION = '0.1' |
| 3 | APPNAME = 'ndn-repo' |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 4 | |
| 5 | from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
| 6 | |
| 7 | def options(opt): |
| 8 | opt.load('compiler_c compiler_cxx gnu_dirs') |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 9 | opt.load('boost default-compiler-flags doxygen sqlite3', tooldir=['.waf-tools']) |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 10 | |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame] | 11 | ropt = opt.add_option_group('ndn-repo-ng Options') |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 12 | |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 13 | ropt.add_option('--with-tests', action='store_true', default=False, dest='with_tests', |
| 14 | help='''build unit tests''') |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 15 | |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 16 | ropt.add_option('--without-tools', action='store_false', default=True, dest='with_tools', |
| 17 | help='''Do not build tools''') |
| 18 | |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 19 | def configure(conf): |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 20 | conf.load("compiler_c compiler_cxx gnu_dirs boost default-compiler-flags sqlite3") |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 21 | |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 22 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 23 | uselib_store='NDN_CXX', mandatory=True) |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 24 | |
Shuo Chen | ccfbe24 | 2014-04-29 23:57:51 +0800 | [diff] [blame] | 25 | conf.check_sqlite3(mandatory=True) |
| 26 | |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 27 | if conf.options.with_tests: |
| 28 | conf.env['WITH_TESTS'] = True |
| 29 | |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 30 | conf.env['WITH_TOOLS'] = conf.options.with_tools |
| 31 | |
Shuo Chen | 9a43f16 | 2014-07-01 13:43:54 +0800 | [diff] [blame^] | 32 | USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem', 'random'] |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 33 | if conf.env['WITH_TESTS']: |
| 34 | USED_BOOST_LIBS += ['unit_test_framework'] |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 35 | conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True) |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 36 | |
| 37 | try: |
| 38 | conf.load("doxygen") |
| 39 | except: |
| 40 | pass |
| 41 | |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame] | 42 | conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/repo-ng.conf' % conf.env['SYSCONFDIR']) |
| 43 | |
| 44 | if not conf.options.with_sqlite_locking: |
| 45 | conf.define('DISABLE_SQLITE3_FS_LOCKING', 1) |
| 46 | |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 47 | conf.write_config_header('src/config.hpp') |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 48 | |
| 49 | def build(bld): |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 50 | bld(target="ndn-repo-objects", |
| 51 | name="ndn-repo-objects", |
| 52 | features=["cxx"], |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 53 | source=bld.path.ant_glob(['src/**/*.cpp'], |
| 54 | excl=['src/main.cpp']), |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 55 | use='NDN_CXX BOOST SQLITE3', |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 56 | includes="src", |
| 57 | export_includes="src", |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 58 | ) |
| 59 | |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 60 | bld(target="ndn-repo-ng", |
| 61 | features=["cxx", "cxxprogram"], |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 62 | source=bld.path.ant_glob(['src/main.cpp']), |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 63 | use='ndn-repo-objects', |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 64 | ) |
| 65 | |
Shuo Chen | ca32918 | 2014-03-19 18:05:18 -0700 | [diff] [blame] | 66 | # Tests |
| 67 | bld.recurse('tests') |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame] | 68 | |
Shuo Chen | ca32918 | 2014-03-19 18:05:18 -0700 | [diff] [blame] | 69 | # Tools |
| 70 | bld.recurse('tools') |
Wentao Shang | bcbc929 | 2014-04-28 21:17:06 -0700 | [diff] [blame] | 71 | |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame] | 72 | bld.install_files('${SYSCONFDIR}/ndn', 'repo-ng.conf.sample') |