Obaid | 2ea377f | 2014-02-27 19:45:15 -0600 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | from waflib import Build, Logs, Utils, Task, TaskGen, Configure |
| 4 | import os |
| 5 | |
| 6 | def options(opt): |
| 7 | opt.load('compiler_cxx gnu_dirs') |
| 8 | opt.load('flags boost doxygen coverage', tooldir=['.waf-tools']) |
Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [diff] [blame] | 9 | |
Obaid | 2ea377f | 2014-02-27 19:45:15 -0600 | [diff] [blame] | 10 | 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 | |
| 14 | def 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 | |
Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [diff] [blame] | 39 | conf.write_config_header('src/config.hpp') |
Obaid | 2ea377f | 2014-02-27 19:45:15 -0600 | [diff] [blame] | 40 | |
| 41 | def build (bld): |
Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [diff] [blame] | 42 | bld( |
| 43 | features=['cxx'], |
| 44 | name="nrd-objects", |
| 45 | source = bld.path.ant_glob('src/*.cpp', excl='src/main.cpp'), |
Obaid | 2ea377f | 2014-02-27 19:45:15 -0600 | [diff] [blame] | 46 | use = 'NDN_CPP BOOST', |
| 47 | ) |
| 48 | |
Obaid | 793401d | 2014-02-27 19:13:49 -0600 | [diff] [blame] | 49 | 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 | ) |