blob: 3a67d9ae1540ce6d82d763832cb299a5e122e37e [file] [log] [blame]
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2VERSION='0.1'
3APPNAME='ndn-repo'
4
5from waflib import Build, Logs, Utils, Task, TaskGen, Configure
6
7def options(opt):
8 opt.load('compiler_c compiler_cxx gnu_dirs')
9 opt.load('boost default-compiler-flags doxygen', tooldir=['.waf-tools'])
10
Shuo Chen478204c2014-03-18 18:27:04 -070011 ropt = opt.add_option_group('ndn-repo-ng Options')
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070012
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070013 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
22def 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 Chen478204c2014-03-18 18:27:04 -070044 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 Afanasyev3fd14f02014-03-26 14:34:39 -070049 conf.write_config_header('config.hpp')
50
51def 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 Chen478204c2014-03-18 18:27:04 -070057 'helpers/*.cpp',
58 'server/*.cpp'],
59 excl=['server/server.cpp']),
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070060 use = 'NDNCPPDEV BOOST SQLITE3',
61 includes = ".",
62 )
63
Shuo Chen478204c2014-03-18 18:27:04 -070064 bld(target = "ndn-repo-ng",
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070065 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 Chen478204c2014-03-18 18:27:04 -070074
75 bld.install_files('${SYSCONFDIR}/ndn', 'repo-ng.conf.sample')