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; -*- |
| 2 | VERSION='0.1' |
| 3 | APPNAME='ndn-repo' |
| 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') |
| 9 | opt.load('boost default-compiler-flags doxygen', tooldir=['.waf-tools']) |
| 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 | |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 13 | ropt.add_option('--with-tests', action = 'store_true', default=False, dest = 'with_tests', |
| 14 | help = '''build unit tests''') |
| 15 | |
| 16 | ropt.add_option('--without-sqlite-locking', action = 'store_false', default = True, |
| 17 | dest = 'with_sqlite_locking', |
| 18 | help = '''Disable filesystem locking in sqlite3 database (use unix-dot ''' |
| 19 | '''locking mechanism instead). This option may be necessary if home ''' |
| 20 | '''directory is hosted on NFS.''') |
| 21 | |
| 22 | def configure(conf): |
| 23 | conf.load("compiler_c compiler_cxx gnu_dirs boost default-compiler-flags") |
| 24 | |
| 25 | conf.check_cfg(package = 'sqlite3', args = ['--cflags', '--libs'], |
| 26 | uselib_store = 'SQLITE3', mandatory = True) |
| 27 | |
| 28 | conf.check_cfg(package = 'libndn-cpp-dev', args = ['--cflags', '--libs'], |
| 29 | uselib_store = 'NDNCPPDEV', mandatory = True) |
| 30 | |
| 31 | if conf.options.with_tests: |
| 32 | conf.env['WITH_TESTS'] = True |
| 33 | |
| 34 | USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem', 'thread'] |
| 35 | if conf.env['WITH_TESTS']: |
| 36 | USED_BOOST_LIBS += ['unit_test_framework'] |
| 37 | conf.check_boost(lib = USED_BOOST_LIBS, mandatory = True) |
| 38 | |
| 39 | try: |
| 40 | conf.load("doxygen") |
| 41 | except: |
| 42 | pass |
| 43 | |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame^] | 44 | conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/repo-ng.conf' % conf.env['SYSCONFDIR']) |
| 45 | |
| 46 | if not conf.options.with_sqlite_locking: |
| 47 | conf.define('DISABLE_SQLITE3_FS_LOCKING', 1) |
| 48 | |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 49 | conf.write_config_header('config.hpp') |
| 50 | |
| 51 | def build(bld): |
| 52 | bld(target = "ndn-repo-objects", |
| 53 | name = "ndn-repo-objects", |
| 54 | features = ["cxx"], |
| 55 | source = bld.path.ant_glob(['ndn-handle/*.cpp', |
| 56 | 'storage/**/*.cpp', |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame^] | 57 | 'helpers/*.cpp', |
| 58 | 'server/*.cpp'], |
| 59 | excl=['server/server.cpp']), |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 60 | use = 'NDNCPPDEV BOOST SQLITE3', |
| 61 | includes = ".", |
| 62 | ) |
| 63 | |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame^] | 64 | bld(target = "ndn-repo-ng", |
Alexander Afanasyev | 3fd14f0 | 2014-03-26 14:34:39 -0700 | [diff] [blame] | 65 | features = ["cxx", "cxxprogram"], |
| 66 | source = bld.path.ant_glob(['server/server.cpp']), |
| 67 | use = 'ndn-repo-objects', |
| 68 | includes = ".", |
| 69 | ) |
| 70 | |
| 71 | # Unit tests |
| 72 | if bld.env['WITH_TESTS']: |
| 73 | bld.recurse('tests') |
Shuo Chen | 478204c | 2014-03-18 18:27:04 -0700 | [diff] [blame^] | 74 | |
| 75 | bld.install_files('${SYSCONFDIR}/ndn', 'repo-ng.conf.sample') |