jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 2 | |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 3 | from waflib import Utils |
| 4 | import os |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 5 | |
Davide Pesavento | bfb33ab | 2022-03-12 23:30:23 -0500 | [diff] [blame^] | 6 | VERSION = '0.1' |
| 7 | APPNAME = 'ndn-traffic-generator' |
| 8 | |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 9 | def options(opt): |
Alexander Afanasyev | 740812e | 2014-10-30 15:37:45 -0700 | [diff] [blame] | 10 | opt.load(['compiler_cxx', 'gnu_dirs']) |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 11 | opt.load(['default-compiler-flags'], |
| 12 | tooldir=['.waf-tools']) |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 13 | |
| 14 | def configure(conf): |
Alexander Afanasyev | 740812e | 2014-10-30 15:37:45 -0700 | [diff] [blame] | 15 | conf.load(['compiler_cxx', 'gnu_dirs', |
| 16 | 'default-compiler-flags']) |
Jennica Guan | b82cace | 2017-02-22 12:19:00 +0800 | [diff] [blame] | 17 | |
Davide Pesavento | bfb33ab | 2022-03-12 23:30:23 -0500 | [diff] [blame^] | 18 | pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig') |
| 19 | conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.0', '--cflags', '--libs'], |
| 20 | uselib_store='NDN_CXX', pkg_config_path=pkg_config_path) |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 21 | |
Davide Pesavento | 64cafaa | 2018-05-24 00:50:41 -0400 | [diff] [blame] | 22 | conf.check_compiler_flags() |
| 23 | |
jeraldabraham | 420dbf0 | 2014-04-25 22:58:31 -0700 | [diff] [blame] | 24 | def build(bld): |
Davide Pesavento | 032c980 | 2019-01-25 17:10:26 -0500 | [diff] [blame] | 25 | bld.program(target='ndn-traffic-client', |
Davide Pesavento | 7eaed5c | 2019-01-09 20:03:43 -0500 | [diff] [blame] | 26 | source='src/ndn-traffic-client.cpp', |
| 27 | use='NDN_CXX') |
jeraldabraham | f9543a4 | 2014-02-11 06:37:34 -0700 | [diff] [blame] | 28 | |
Davide Pesavento | 7eaed5c | 2019-01-09 20:03:43 -0500 | [diff] [blame] | 29 | bld.program(target='ndn-traffic-server', |
| 30 | source='src/ndn-traffic-server.cpp', |
| 31 | use='NDN_CXX') |
Alexander Afanasyev | fda32a3 | 2014-03-20 10:50:00 -0700 | [diff] [blame] | 32 | |
| 33 | bld.install_files('${SYSCONFDIR}/ndn', ['ndn-traffic-client.conf.sample', |
| 34 | 'ndn-traffic-server.conf.sample']) |
Davide Pesavento | e5a7394 | 2019-01-26 20:54:13 -0500 | [diff] [blame] | 35 | |
| 36 | if Utils.unversioned_sys_platform() == 'linux': |
| 37 | systemd_units = bld.path.ant_glob('systemd/*.in') |
| 38 | bld(features='subst', |
| 39 | name='systemd-units', |
| 40 | source=systemd_units, |
| 41 | target=[u.change_ext('') for u in systemd_units]) |