Yingdi Yu | ce94f35 | 2015-04-11 19:17:01 -0700 | [diff] [blame^] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
| 3 | """ |
| 4 | Copyright (c) 2014-2015, Regents of the University of California |
| 5 | |
| 6 | This file is part of ndn-group-encrypt (Group-based Encryption Protocol for NDN). |
| 7 | See AUTHORS.md for complete list of ndn-group-encrypt authors and contributors. |
| 8 | |
| 9 | ndn-group-encrypt is free software: you can redistribute it and/or modify it under the terms |
| 10 | of the GNU General Public License as published by the Free Software Foundation, |
| 11 | either version 3 of the License, or (at your option) any later version. |
| 12 | |
| 13 | ndn-group-encrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 14 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 | PURPOSE. See the GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License along with |
| 18 | ndn-group-encrypt, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 19 | """ |
| 20 | |
| 21 | VERSION = "0.0.1" |
| 22 | APPNAME = "libndn-group-encrypt" |
| 23 | BUGREPORT = "http://redmine.named-data.net/projects/gep" |
| 24 | URL = "http://named-data.net/doc/ndn-group-encrypt/" |
| 25 | GIT_TAG_PREFIX = "NDN-GROUP-ENCRYPT" |
| 26 | |
| 27 | from waflib import Logs, Utils, Context |
| 28 | import os |
| 29 | |
| 30 | def 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 | |
| 42 | def configure(conf): |
| 43 | conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', 'boost', 'default-compiler-flags']) |
| 44 | |
| 45 | conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], |
| 46 | uselib_store='NDN_CXX', mandatory=True) |
| 47 | |
| 48 | boost_libs = 'system iostreams' |
| 49 | if conf.options._tests: |
| 50 | conf.env['NDN_GEP_HAVE_TESTS'] = 1 |
| 51 | conf.define('NDN_GEP_HAVE_TESTS', 1); |
| 52 | boost_libs += ' unit_test_framework' |
| 53 | |
| 54 | conf.check_boost(lib=boost_libs) |
| 55 | |
| 56 | conf.write_config_header('config.hpp') |
| 57 | |
| 58 | def build(bld): |
| 59 | libndn_group_encrypt = bld( |
| 60 | target="libndn-group-encrypt", |
| 61 | # vnum = "0.0.1", |
| 62 | features=['cxx', 'cxxshlib'], |
| 63 | source = bld.path.ant_glob(['src/**/*.cpp']), |
| 64 | use = 'BOOST NDN_CXX', |
| 65 | includes = ['src', '.'], |
| 66 | export_includes=['src', '.'], |
| 67 | ) |
| 68 | |
| 69 | # Unit tests |
| 70 | if bld.env["NDN_GEP_HAVE_TESTS"]: |
| 71 | bld.recurse('tests') |
| 72 | |
| 73 | bld.install_files( |
| 74 | dest = "%s/ndn-group-encrypt" % bld.env['INCLUDEDIR'], |
| 75 | files = bld.path.get_bld().ant_glob(['src/**/*.hpp', 'common.hpp', 'config.hpp']), |
| 76 | cwd = bld.path.get_bld().find_dir("src"), |
| 77 | relative_trick = False, |
| 78 | ) |
| 79 | |
| 80 | pc = bld( |
| 81 | features = "subst", |
| 82 | source='ndn-group-encrypt.pc.in', |
| 83 | target='ndn-group-encrypt.pc', |
| 84 | install_path = '${LIBDIR}/pkgconfig', |
| 85 | PREFIX = bld.env['PREFIX'], |
| 86 | INCLUDEDIR = "%s/ndn-group-encrypt" % bld.env['INCLUDEDIR'], |
| 87 | VERSION = VERSION, |
| 88 | ) |