blob: ccd14d32de67d594ff3eb2c1e0c886d3ce1f804e [file] [log] [blame]
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Wentao Shangbcbc9292014-04-28 21:17:06 -07002VERSION = '0.1'
3APPNAME = 'ndn-repo'
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -07004
5from waflib import Build, Logs, Utils, Task, TaskGen, Configure
6
7def options(opt):
8 opt.load('compiler_c compiler_cxx gnu_dirs')
Shuo Chenccfbe242014-04-29 23:57:51 +08009 opt.load('boost default-compiler-flags doxygen sqlite3', tooldir=['.waf-tools'])
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070010
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
Wentao Shangbcbc9292014-04-28 21:17:06 -070013 ropt.add_option('--with-tests', action='store_true', default=False, dest='with_tests',
14 help='''build unit tests''')
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070015
Wentao Shangbcbc9292014-04-28 21:17:06 -070016 ropt.add_option('--without-tools', action='store_false', default=True, dest='with_tools',
17 help='''Do not build tools''')
18
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070019def configure(conf):
Shuo Chenccfbe242014-04-29 23:57:51 +080020 conf.load("compiler_c compiler_cxx gnu_dirs boost default-compiler-flags sqlite3")
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070021
Wentao Shangbcbc9292014-04-28 21:17:06 -070022 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
23 uselib_store='NDN_CXX', mandatory=True)
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070024
Shuo Chenccfbe242014-04-29 23:57:51 +080025 conf.check_sqlite3(mandatory=True)
26
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070027 if conf.options.with_tests:
28 conf.env['WITH_TESTS'] = True
29
Wentao Shangbcbc9292014-04-28 21:17:06 -070030 conf.env['WITH_TOOLS'] = conf.options.with_tools
31
Shuo Chen9a43f162014-07-01 13:43:54 +080032 USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem', 'random']
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070033 if conf.env['WITH_TESTS']:
34 USED_BOOST_LIBS += ['unit_test_framework']
Wentao Shangbcbc9292014-04-28 21:17:06 -070035 conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True)
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070036
37 try:
38 conf.load("doxygen")
39 except:
40 pass
41
Shuo Chen478204c2014-03-18 18:27:04 -070042 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 Afanasyev39d98072014-05-04 12:46:29 -070047 conf.write_config_header('src/config.hpp')
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070048
49def build(bld):
Wentao Shangbcbc9292014-04-28 21:17:06 -070050 bld(target="ndn-repo-objects",
51 name="ndn-repo-objects",
52 features=["cxx"],
Alexander Afanasyev39d98072014-05-04 12:46:29 -070053 source=bld.path.ant_glob(['src/**/*.cpp'],
54 excl=['src/main.cpp']),
Wentao Shangbcbc9292014-04-28 21:17:06 -070055 use='NDN_CXX BOOST SQLITE3',
Alexander Afanasyev39d98072014-05-04 12:46:29 -070056 includes="src",
57 export_includes="src",
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070058 )
59
Wentao Shangbcbc9292014-04-28 21:17:06 -070060 bld(target="ndn-repo-ng",
61 features=["cxx", "cxxprogram"],
Alexander Afanasyev39d98072014-05-04 12:46:29 -070062 source=bld.path.ant_glob(['src/main.cpp']),
Wentao Shangbcbc9292014-04-28 21:17:06 -070063 use='ndn-repo-objects',
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070064 )
65
Shuo Chenca329182014-03-19 18:05:18 -070066 # Tests
67 bld.recurse('tests')
Shuo Chen478204c2014-03-18 18:27:04 -070068
Shuo Chenca329182014-03-19 18:05:18 -070069 # Tools
70 bld.recurse('tools')
Wentao Shangbcbc9292014-04-28 21:17:06 -070071
Shuo Chen478204c2014-03-18 18:27:04 -070072 bld.install_files('${SYSCONFDIR}/ndn', 'repo-ng.conf.sample')