Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | VERSION = "0.1.0" |
| 3 | APPNAME = "ndncert" |
| 4 | BUGREPORT = "http://redmine.named-data.net/projects/ndncert" |
| 5 | GIT_TAG_PREFIX = "ndncert" |
| 6 | |
| 7 | from waflib import Logs, Utils, Context |
| 8 | import os |
| 9 | |
| 10 | def options(opt): |
| 11 | opt.load(['compiler_cxx', 'gnu_dirs']) |
| 12 | opt.load(['boost', 'default-compiler-flags', 'sqlite3', |
| 13 | 'coverage', 'sanitizers', |
| 14 | 'doxygen', 'sphinx_build'], tooldir=['.waf-tools']) |
| 15 | |
| 16 | syncopt = opt.add_option_group ("ndncert options") |
| 17 | syncopt.add_option('--with-tests', action='store_true', default=False, dest='with_tests', |
| 18 | help='''build unit tests''') |
| 19 | |
| 20 | def configure(conf): |
| 21 | conf.load(['compiler_cxx', 'gnu_dirs', |
| 22 | 'boost', 'default-compiler-flags', 'sqlite3', |
| 23 | 'doxygen', 'sphinx_build']) |
| 24 | |
| 25 | if 'PKG_CONFIG_PATH' not in os.environ: |
| 26 | os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env) |
| 27 | |
| 28 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 29 | uselib_store='NDN_CXX', mandatory=True) |
| 30 | |
| 31 | USED_BOOST_LIBS = ['system', 'filesystem', 'iostreams', |
| 32 | 'program_options', 'thread', 'log', 'log_setup'] |
| 33 | |
| 34 | conf.env['WITH_TESTS'] = conf.options.with_tests |
| 35 | if conf.env['WITH_TESTS']: |
| 36 | USED_BOOST_LIBS += ['unit_test_framework'] |
| 37 | conf.define('HAVE_TESTS', 1) |
| 38 | |
| 39 | conf.check_boost(lib=USED_BOOST_LIBS, mt=True) |
| 40 | if conf.env.BOOST_VERSION_NUMBER < 105400: |
| 41 | Logs.error("Minimum required boost version is 1.54.0") |
| 42 | Logs.error("Please upgrade your distribution or install custom boost libraries" + |
| 43 | " (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)") |
| 44 | return |
| 45 | |
| 46 | # Loading "late" to prevent tests to be compiled with profiling flags |
| 47 | conf.load('coverage') |
| 48 | |
| 49 | conf.load('sanitizers') |
Zhiyi Zhang | 65ba932 | 2017-01-19 14:15:03 -0800 | [diff] [blame] | 50 | |
Zhiyi Zhang | 8617a79 | 2017-01-17 16:45:56 -0800 | [diff] [blame] | 51 | conf.write_config_header('src/ndncert-config.hpp') |
| 52 | |
| 53 | def build(bld): |
| 54 | core = bld( |
| 55 | target = "objects", |
| 56 | features=['cxx'], |
| 57 | source = bld.path.ant_glob(['src/**/*.cpp']), |
| 58 | use = 'NDN_CXX BOOST', |
| 59 | includes = ['src'], |
| 60 | export_includes=['src'], |
| 61 | ) |
| 62 | |
| 63 | bld.recurse('tests') |