blob: a1f7a76a894a88a16830eb9043b17436d1f08a9b [file] [log] [blame]
Obaid2ea377f2014-02-27 19:45:15 -06001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3from waflib import Build, Logs, Utils, Task, TaskGen, Configure
4import os
5
6def options(opt):
7 opt.load('compiler_cxx gnu_dirs')
8 opt.load('flags boost doxygen coverage', tooldir=['.waf-tools'])
Obaid793401d2014-02-27 19:13:49 -06009
Obaid2ea377f2014-02-27 19:45:15 -060010 nrdopt = opt.add_option_group('NRD Options')
11 nrdopt.add_option('--debug',action='store_true',default=False,dest='debug',help='''Compile library debugging mode without all optimizations (-O0)''')
12 nrdopt.add_option('--with-tests', action='store_true',default=False,dest='with_tests',help='''Build unit tests''')
13
14def configure(conf):
15 conf.load("compiler_cxx gnu_dirs boost flags")
16
17 conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
18
19 boost_libs='system'
20 if conf.options.with_tests:
21 conf.env['WITH_TESTS'] = 1
22 conf.define('WITH_TESTS', 1);
23 boost_libs+=' unit_test_framework'
24
25 conf.check_boost(lib=boost_libs)
26 if conf.env.BOOST_VERSION_NUMBER < 104800:
27 Logs.error ("Minimum required boost version is 1.48")
28 Logs.error ("Please upgrade your distribution or install custom boost libraries" +
29 " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
30 return
31
32 # conf.load('coverage')
33
34 # try:
35 # conf.load('doxygen')
36 # except:
37 # pass
38
Obaid793401d2014-02-27 19:13:49 -060039 conf.write_config_header('src/config.hpp')
Obaid2ea377f2014-02-27 19:45:15 -060040
41def build (bld):
Obaid793401d2014-02-27 19:13:49 -060042 bld(
43 features=['cxx'],
44 name="nrd-objects",
45 source = bld.path.ant_glob('src/*.cpp', excl='src/main.cpp'),
Obaid2ea377f2014-02-27 19:45:15 -060046 use = 'NDN_CPP BOOST',
47 )
48
Obaid793401d2014-02-27 19:13:49 -060049 bld.program(
50 target = 'nrd',
51 source = 'src/main.cpp',
52 use = 'nrd-objects'
53 )
54
55 # Unit tests
56 if bld.env['WITH_TESTS']:
57 unit_tests = unittests = bld.program(
58 target='unit-tests',
59 features = 'cxx cxxprogram',
60 source = bld.path.ant_glob(['tests/**/*.cpp']),
61 use = 'nrd-objects',
62 includes = ['.', 'src'],
63 install_prefix = None,
64 )