blob: 89c8f4061e578785b3ab7d47b8425193435f7ceb [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
Obaid793401d2014-02-27 19:13:49 -060042 conf.write_config_header('src/config.hpp')
Obaid2ea377f2014-02-27 19:45:15 -060043
44def build (bld):
Obaid793401d2014-02-27 19:13:49 -060045 bld(
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070046 features='cxx',
47 name='nrd-objects',
48 source=bld.path.ant_glob('src/*.cpp',
49 excl='src/main.cpp'),
50 use='NDN_CPP BOOST',
Obaid2ea377f2014-02-27 19:45:15 -060051 )
52
Obaid793401d2014-02-27 19:13:49 -060053 bld.program(
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070054 target='nrd',
55 source='src/main.cpp',
56 use='nrd-objects'
Obaid793401d2014-02-27 19:13:49 -060057 )
58
59 # Unit tests
60 if bld.env['WITH_TESTS']:
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070061 unit_tests = bld.program(
Obaid793401d2014-02-27 19:13:49 -060062 target='unit-tests',
Alexander Afanasyev80f06a52014-03-27 14:40:00 -070063 features='cxx cxxprogram',
64 source=bld.path.ant_glob(['tests/**/*.cpp']),
65 use='nrd-objects',
66 includes=['.', 'src'],
67 install_prefix=None,
Obaid793401d2014-02-27 19:13:49 -060068 )