blob: 725c2377bd6960e26d89b079cff13b7335d816e9 [file] [log] [blame]
Yingdi Yuce94f352015-04-11 19:17:01 -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
6This file is part of ndn-group-encrypt (Group-based Encryption Protocol for NDN).
7See AUTHORS.md for complete list of ndn-group-encrypt authors and contributors.
8
9ndn-group-encrypt is free software: you can redistribute it and/or modify it under the terms
10of the GNU General Public License as published by the Free Software Foundation,
11either version 3 of the License, or (at your option) any later version.
12
13ndn-group-encrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15PURPOSE. See the GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License along with
18ndn-group-encrypt, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19"""
20
21VERSION = "0.0.1"
22APPNAME = "libndn-group-encrypt"
23BUGREPORT = "http://redmine.named-data.net/projects/gep"
24URL = "http://named-data.net/doc/ndn-group-encrypt/"
25GIT_TAG_PREFIX = "NDN-GROUP-ENCRYPT"
26
27from waflib import Logs, Utils, Context
28import os
29
30def options(opt):
31 opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs'])
32 opt.load(['boost', 'default-compiler-flags'],
33 tooldir=['.waf-tools'])
34
35 syncopt = opt.add_option_group ("NDN-GROUP-ENCRYPT Options")
36
37 syncopt.add_option('--debug', action='store_true', default=False, dest='debug',
38 help='''debugging mode''')
39 syncopt.add_option('--with-tests', action='store_true', default=False, dest='_tests',
40 help='''build unit tests''')
41
42def configure(conf):
43 conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', 'boost', 'default-compiler-flags'])
44
Yingdi Yuda495a92015-05-05 13:57:59 -070045 if 'PKG_CONFIG_PATH' not in os.environ:
46 os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
Yingdi Yuce94f352015-04-11 19:17:01 -070047 conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
48 uselib_store='NDN_CXX', mandatory=True)
49
50 boost_libs = 'system iostreams'
51 if conf.options._tests:
52 conf.env['NDN_GEP_HAVE_TESTS'] = 1
53 conf.define('NDN_GEP_HAVE_TESTS', 1);
54 boost_libs += ' unit_test_framework'
55
56 conf.check_boost(lib=boost_libs)
57
58 conf.write_config_header('config.hpp')
59
60def build(bld):
61 libndn_group_encrypt = bld(
Yingdi Yuda495a92015-05-05 13:57:59 -070062 target="ndn-group-encrypt",
Yingdi Yuce94f352015-04-11 19:17:01 -070063 # vnum = "0.0.1",
64 features=['cxx', 'cxxshlib'],
65 source = bld.path.ant_glob(['src/**/*.cpp']),
66 use = 'BOOST NDN_CXX',
67 includes = ['src', '.'],
68 export_includes=['src', '.'],
69 )
70
71 # Unit tests
72 if bld.env["NDN_GEP_HAVE_TESTS"]:
73 bld.recurse('tests')
74
75 bld.install_files(
76 dest = "%s/ndn-group-encrypt" % bld.env['INCLUDEDIR'],
Yingdi Yu0a6663a2016-03-20 18:55:46 -070077 files = bld.path.ant_glob(['src/**/*.hpp', 'src/**/*.h', 'common.hpp']),
78 cwd = bld.path.find_dir("src"),
79 relative_trick = False,
80 )
81
82
83 bld.install_files(
84 dest = "%s/ndn-group-encrypt" % bld.env['INCLUDEDIR'],
Yingdi Yuce94f352015-04-11 19:17:01 -070085 files = bld.path.get_bld().ant_glob(['src/**/*.hpp', 'common.hpp', 'config.hpp']),
86 cwd = bld.path.get_bld().find_dir("src"),
87 relative_trick = False,
88 )
89
Yingdi Yuda495a92015-05-05 13:57:59 -070090 bld(features = "subst",
Yingdi Yuce94f352015-04-11 19:17:01 -070091 source='ndn-group-encrypt.pc.in',
92 target='ndn-group-encrypt.pc',
93 install_path = '${LIBDIR}/pkgconfig',
94 PREFIX = bld.env['PREFIX'],
95 INCLUDEDIR = "%s/ndn-group-encrypt" % bld.env['INCLUDEDIR'],
96 VERSION = VERSION,
97 )