blob: f25aebf154d5b18dcc51124464d5301291109401 [file] [log] [blame]
Obaid2ea377f2014-02-27 19:45:15 -06001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
Alexander Afanasyev80f06a52014-03-27 14:40:00 -07003from waflib import Logs
Obaid2ea377f2014-02-27 19:45:15 -06004
5def options(opt):
6 opt.load('compiler_cxx gnu_dirs')
7 opt.load('flags boost doxygen coverage', tooldir=['.waf-tools'])
Obaid793401d2014-02-27 19:13:49 -06008
Obaid2ea377f2014-02-27 19:45:15 -06009 nrdopt = opt.add_option_group('NRD Options')
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070010 nrdopt.add_option('--debug', action='store_true', default=False,
11 dest='debug',
12 help='''Compile library debugging mode without all optimizations (-O0)''')
13 nrdopt.add_option('--with-tests', action='store_true',
14 default=False, dest='with_tests', help='''Build unit tests''')
Obaid2ea377f2014-02-27 19:45:15 -060015
16def configure(conf):
17 conf.load("compiler_cxx gnu_dirs boost flags")
18
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070019 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'],
20 uselib_store='NDN_CPP', mandatory=True)
Obaid2ea377f2014-02-27 19:45:15 -060021
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070022 boost_libs = 'system'
Obaid2ea377f2014-02-27 19:45:15 -060023 if conf.options.with_tests:
24 conf.env['WITH_TESTS'] = 1
25 conf.define('WITH_TESTS', 1);
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070026 boost_libs += ' unit_test_framework'
Obaid2ea377f2014-02-27 19:45:15 -060027
28 conf.check_boost(lib=boost_libs)
29 if conf.env.BOOST_VERSION_NUMBER < 104800:
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070030 Logs.error("Minimum required boost version is 1.48")
31 Logs.error("Please upgrade your distribution or install custom boost libraries" +
32 " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
Obaid2ea377f2014-02-27 19:45:15 -060033 return
34
35 # conf.load('coverage')
36
37 # try:
38 # conf.load('doxygen')
39 # except:
40 # pass
41
Obaid5748c0c2014-04-09 18:00:42 -050042 conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nrd.conf' % conf.env['SYSCONFDIR'])
Obaid793401d2014-02-27 19:13:49 -060043 conf.write_config_header('src/config.hpp')
Obaid2ea377f2014-02-27 19:45:15 -060044
45def build (bld):
Obaid793401d2014-02-27 19:13:49 -060046 bld(
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070047 features='cxx',
48 name='nrd-objects',
49 source=bld.path.ant_glob('src/*.cpp',
50 excl='src/main.cpp'),
51 use='NDN_CPP BOOST',
Obaid2ea377f2014-02-27 19:45:15 -060052 )
53
Obaid793401d2014-02-27 19:13:49 -060054 bld.program(
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070055 target='nrd',
56 source='src/main.cpp',
57 use='nrd-objects'
Obaid793401d2014-02-27 19:13:49 -060058 )
59
60 # Unit tests
61 if bld.env['WITH_TESTS']:
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070062 unit_tests = bld.program(
Obaid793401d2014-02-27 19:13:49 -060063 target='unit-tests',
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070064 features='cxx cxxprogram',
65 source=bld.path.ant_glob(['tests/**/*.cpp']),
66 use='nrd-objects',
67 includes=['.', 'src'],
68 install_prefix=None,
Obaid5748c0c2014-04-09 18:00:42 -050069 )
70
71 bld.install_files('${SYSCONFDIR}/ndn', 'nrd.conf.sample')
72