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 | |
| 11 | ropt = opt.add_option_group('NDN Repo Options') |
| 12 | |
| 13 | ropt.add_option('--debug',action = 'store_true',default = False,dest = 'debug', |
| 14 | help='''debugging mode''') |
| 15 | ropt.add_option('--with-tests', action = 'store_true', default=False, dest = 'with_tests', |
| 16 | help = '''build unit tests''') |
| 17 | |
| 18 | ropt.add_option('--without-sqlite-locking', action = 'store_false', default = True, |
| 19 | dest = 'with_sqlite_locking', |
| 20 | help = '''Disable filesystem locking in sqlite3 database (use unix-dot ''' |
| 21 | '''locking mechanism instead). This option may be necessary if home ''' |
| 22 | '''directory is hosted on NFS.''') |
| 23 | |
| 24 | def configure(conf): |
| 25 | conf.load("compiler_c compiler_cxx gnu_dirs boost default-compiler-flags") |
| 26 | |
| 27 | conf.check_cfg(package = 'sqlite3', args = ['--cflags', '--libs'], |
| 28 | uselib_store = 'SQLITE3', mandatory = True) |
| 29 | |
| 30 | conf.check_cfg(package = 'libndn-cpp-dev', args = ['--cflags', '--libs'], |
| 31 | uselib_store = 'NDNCPPDEV', mandatory = True) |
| 32 | |
| 33 | if conf.options.with_tests: |
| 34 | conf.env['WITH_TESTS'] = True |
| 35 | |
| 36 | USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem', 'thread'] |
| 37 | if conf.env['WITH_TESTS']: |
| 38 | USED_BOOST_LIBS += ['unit_test_framework'] |
| 39 | conf.check_boost(lib = USED_BOOST_LIBS, mandatory = True) |
| 40 | |
| 41 | try: |
| 42 | conf.load("doxygen") |
| 43 | except: |
| 44 | pass |
| 45 | |
| 46 | conf.write_config_header('config.hpp') |
| 47 | |
| 48 | def build(bld): |
| 49 | bld(target = "ndn-repo-objects", |
| 50 | name = "ndn-repo-objects", |
| 51 | features = ["cxx"], |
| 52 | source = bld.path.ant_glob(['ndn-handle/*.cpp', |
| 53 | 'storage/**/*.cpp', |
| 54 | 'helpers/*.cpp']), |
| 55 | use = 'NDNCPPDEV BOOST SQLITE3', |
| 56 | includes = ".", |
| 57 | ) |
| 58 | |
| 59 | bld(target = "ndn-repo", |
| 60 | features = ["cxx", "cxxprogram"], |
| 61 | source = bld.path.ant_glob(['server/server.cpp']), |
| 62 | use = 'ndn-repo-objects', |
| 63 | includes = ".", |
| 64 | ) |
| 65 | |
| 66 | # Unit tests |
| 67 | if bld.env['WITH_TESTS']: |
| 68 | bld.recurse('tests') |