blob: 3b1a38d93cc30ec758d57faaf665f328b61d8598 [file] [log] [blame]
jeraldabrahamf9543a42014-02-11 06:37:34 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
Jennica Guanb82cace2017-02-22 12:19:00 +08002
Jennica Guanb82cace2017-02-22 12:19:00 +08003from waflib import Utils
4import os
jeraldabrahamf9543a42014-02-11 06:37:34 -07005
Davide Pesaventobfb33ab2022-03-12 23:30:23 -05006VERSION = '0.1'
7APPNAME = 'ndn-traffic-generator'
8
jeraldabrahamf9543a42014-02-11 06:37:34 -07009def options(opt):
Alexander Afanasyev740812e2014-10-30 15:37:45 -070010 opt.load(['compiler_cxx', 'gnu_dirs'])
Jennica Guanb82cace2017-02-22 12:19:00 +080011 opt.load(['default-compiler-flags'],
12 tooldir=['.waf-tools'])
jeraldabrahamf9543a42014-02-11 06:37:34 -070013
14def configure(conf):
Alexander Afanasyev740812e2014-10-30 15:37:45 -070015 conf.load(['compiler_cxx', 'gnu_dirs',
16 'default-compiler-flags'])
Jennica Guanb82cace2017-02-22 12:19:00 +080017
Davide Pesaventof5006be2022-08-19 17:36:36 -040018 # Prefer pkgconf if it's installed, because it gives more correct results
19 # on Fedora/CentOS/RHEL/etc. See https://bugzilla.redhat.com/show_bug.cgi?id=1953348
20 # Store the result in env.PKGCONFIG, which is the variable used inside check_cfg()
21 conf.find_program(['pkgconf', 'pkg-config'], var='PKGCONFIG')
22
Davide Pesaventobfb33ab2022-03-12 23:30:23 -050023 pkg_config_path = os.environ.get('PKG_CONFIG_PATH', f'{conf.env.LIBDIR}/pkgconfig')
24 conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.0', '--cflags', '--libs'],
25 uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
jeraldabrahamf9543a42014-02-11 06:37:34 -070026
Davide Pesavento64cafaa2018-05-24 00:50:41 -040027 conf.check_compiler_flags()
28
jeraldabraham420dbf02014-04-25 22:58:31 -070029def build(bld):
Davide Pesavento032c9802019-01-25 17:10:26 -050030 bld.program(target='ndn-traffic-client',
Davide Pesavento7eaed5c2019-01-09 20:03:43 -050031 source='src/ndn-traffic-client.cpp',
32 use='NDN_CXX')
jeraldabrahamf9543a42014-02-11 06:37:34 -070033
Davide Pesavento7eaed5c2019-01-09 20:03:43 -050034 bld.program(target='ndn-traffic-server',
35 source='src/ndn-traffic-server.cpp',
36 use='NDN_CXX')
Alexander Afanasyevfda32a32014-03-20 10:50:00 -070037
38 bld.install_files('${SYSCONFDIR}/ndn', ['ndn-traffic-client.conf.sample',
39 'ndn-traffic-server.conf.sample'])
Davide Pesaventoe5a73942019-01-26 20:54:13 -050040
41 if Utils.unversioned_sys_platform() == 'linux':
42 systemd_units = bld.path.ant_glob('systemd/*.in')
43 bld(features='subst',
44 name='systemd-units',
45 source=systemd_units,
46 target=[u.change_ext('') for u in systemd_units])