Alexander Afanasyev | 4536b09 | 2014-04-16 13:30:39 -0700 | [diff] [blame^] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib import Logs |
| 4 | |
| 5 | def options(opt): |
| 6 | opt.load('compiler_cxx gnu_dirs') |
| 7 | opt.load('flags boost doxygen coverage', tooldir=['.waf-tools']) |
| 8 | |
| 9 | nrdopt = opt.add_option_group('NRD Options') |
| 10 | 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''') |
| 15 | |
| 16 | def configure(conf): |
| 17 | conf.load("compiler_cxx gnu_dirs boost flags") |
| 18 | |
| 19 | conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], |
| 20 | uselib_store='NDN_CPP', mandatory=True) |
| 21 | |
| 22 | boost_libs = 'system' |
| 23 | if conf.options.with_tests: |
| 24 | conf.env['WITH_TESTS'] = 1 |
| 25 | conf.define('WITH_TESTS', 1); |
| 26 | boost_libs += ' unit_test_framework' |
| 27 | |
| 28 | conf.check_boost(lib=boost_libs) |
| 29 | if conf.env.BOOST_VERSION_NUMBER < 104800: |
| 30 | 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)") |
| 33 | return |
| 34 | |
| 35 | # conf.load('coverage') |
| 36 | |
| 37 | # try: |
| 38 | # conf.load('doxygen') |
| 39 | # except: |
| 40 | # pass |
| 41 | |
| 42 | conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nrd.conf' % conf.env['SYSCONFDIR']) |
| 43 | conf.write_config_header('src/config.hpp') |
| 44 | |
| 45 | def build (bld): |
| 46 | bld( |
| 47 | features='cxx', |
| 48 | name='nrd-objects', |
| 49 | source=bld.path.ant_glob('src/*.cpp', |
| 50 | excl='src/main.cpp'), |
| 51 | use='NDN_CPP BOOST', |
| 52 | ) |
| 53 | |
| 54 | bld.program( |
| 55 | target='nrd', |
| 56 | source='src/main.cpp', |
| 57 | use='nrd-objects' |
| 58 | ) |
| 59 | |
| 60 | # Unit tests |
| 61 | if bld.env['WITH_TESTS']: |
| 62 | unit_tests = bld.program( |
| 63 | target='unit-tests', |
| 64 | features='cxx cxxprogram', |
| 65 | source=bld.path.ant_glob(['tests/**/*.cpp']), |
| 66 | use='nrd-objects', |
| 67 | includes=['.', 'src'], |
| 68 | install_prefix=None, |
| 69 | ) |
| 70 | |
| 71 | bld.install_files('${SYSCONFDIR}/ndn', 'nrd.conf.sample') |