blob: df0b84c49731d457373bf158703a4722d7f2b69f [file] [log] [blame]
Chengyu Faneb0422c2015-03-04 16:34:14 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3"""
4Copyright (c) 2014-2015, Regents of the University of California,
5 Arizona Board of Regents,
6 Colorado State University,
7 University Pierre & Marie Curie, Sorbonne University,
8 Washington University in St. Louis,
9 Beijing Institute of Technology
10
11This file is part of NFD (Named Data Networking Forwarding Daemon).
12See AUTHORS.md for complete list of NFD authors and contributors.
13
14NFD is free software: you can redistribute it and/or modify it under the terms
15of the GNU General Public License as published by the Free Software Foundation,
16either version 3 of the License, or (at your option) any later version.
17
18NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20PURPOSE. See the GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License along with
23NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24"""
25
26
27VERSION='0.1'
28APPNAME='ndn-atmos'
29
30from waflib import Configure, Utils, Logs, Context
31import os
32
33def options(opt):
34 opt.load(['compiler_cxx', 'gnu_dirs'])
35
36 opt.load(['default-compiler-flags', 'boost'],
37 tooldir=['.waf-tools'])
38
39 opt = opt.add_option_group('ndn-atmos Options')
40
41 opt.add_option('--with-tests', action='store_true', default=False,
42 dest='with_tests', help='''build unit tests''')
43
44def configure(conf):
45 conf.load(['compiler_cxx', 'default-compiler-flags', 'boost', 'gnu_dirs'])
46
47 conf.find_program('bash', var='BASH')
48
49 if not os.environ.has_key('PKG_CONFIG_PATH'):
50 os.environ['PKG_CONFIG_PATH'] = ':'.join([
51 '/usr/local/lib/pkgconfig',
52 '/opt/local/lib/pkgconfig'])
53
54 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
55 uselib_store='NDN_CXX', mandatory=True)
56
Chengyu Fan8b92f122015-03-09 22:13:36 -060057 conf.check_cfg(package='ChronoSync', args=['ChronoSync >= 0.1', '--cflags', '--libs'],
58 uselib_store='SYNC', mandatory=True)
59
60 conf.check_cfg(package='jsoncpp', args=['--cflags', '--libs'],
61 uselib_store='JSON', mandatory=True)
62
63 conf.check_cfg(package='libpq', args=['--cflags', '--libs'],
64 uselib_store='SQL_PQ', mandatory=True)
Chengyu Faneb0422c2015-03-04 16:34:14 -070065
66 boost_libs = 'system random thread filesystem'
67
68 if conf.options.with_tests:
69 conf.env['WITH_TESTS'] = 1
70 conf.define('WITH_TESTS', 1);
71 boost_libs += ' unit_test_framework'
72
73 conf.check_boost(lib=boost_libs, mandatory=True)
74 if conf.env.BOOST_VERSION_NUMBER < 104800:
75 Logs.error("Minimum required boost version is 1.48.0")
76 Logs.error("Please upgrade your distribution or install custom boost libraries" +
77 " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
78 return
79
80 conf.write_config_header('config.h')
81
82def build (bld):
Chengyu Fan8b92f122015-03-09 22:13:36 -060083 ndn_atmos_objects = bld(
84 target='ndn_atmos_objects',
85 name='ndn_atmos_objects',
86 features='cxx',
87 source=bld.path.ant_glob(['catalog/src/*.cpp'],
88 excl=['catalog/src/main.cpp']),
89 use='NDN_CXX BOOST SYNC JSON SQL_PQ',
90 includes='catalog/src .',
91 export_includes='catalog/src .'
92 )
93
Chengyu Faneb0422c2015-03-04 16:34:14 -070094 bld(
Chengyu Fan8b92f122015-03-09 22:13:36 -060095 target='bin/ndn-atmos',
96 features='cxx cxxprogram',
97 source='catalog/src/main.cpp',
98 use='ndn_atmos_objects'
Chengyu Faneb0422c2015-03-04 16:34:14 -070099 )
100
101 # Catalog unit tests
102 if bld.env['WITH_TESTS']:
103 bld.recurse('catalog/tests')