blob: e49a083c2970094a11fc1a9a9d332a69f754b493 [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 +08003import os
Davide Pesaventoedd21842023-09-11 22:24:44 -04004from waflib import Utils
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'])
Davide Pesaventoedd21842023-09-11 22:24:44 -040011 opt.load(['default-compiler-flags', 'boost'],
Jennica Guanb82cace2017-02-22 12:19:00 +080012 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',
Davide Pesaventoedd21842023-09-11 22:24:44 -040016 'default-compiler-flags', 'boost'])
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')
Davide Pesavento326ec852023-02-14 16:42:33 -050024 conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'],
Davide Pesaventobfb33ab2022-03-12 23:30:23 -050025 uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
jeraldabrahamf9543a42014-02-11 06:37:34 -070026
Davide Pesaventoedd21842023-09-11 22:24:44 -040027 boost_libs = ['date_time', 'filesystem', 'program_options', 'thread']
28 conf.check_boost(lib=boost_libs, mt=True)
29
Davide Pesavento64cafaa2018-05-24 00:50:41 -040030 conf.check_compiler_flags()
31
jeraldabraham420dbf02014-04-25 22:58:31 -070032def build(bld):
Davide Pesavento032c9802019-01-25 17:10:26 -050033 bld.program(target='ndn-traffic-client',
Davide Pesavento7eaed5c2019-01-09 20:03:43 -050034 source='src/ndn-traffic-client.cpp',
Davide Pesaventoedd21842023-09-11 22:24:44 -040035 use='NDN_CXX BOOST')
jeraldabrahamf9543a42014-02-11 06:37:34 -070036
Davide Pesavento7eaed5c2019-01-09 20:03:43 -050037 bld.program(target='ndn-traffic-server',
38 source='src/ndn-traffic-server.cpp',
Davide Pesaventoedd21842023-09-11 22:24:44 -040039 use='NDN_CXX BOOST')
Alexander Afanasyevfda32a32014-03-20 10:50:00 -070040
41 bld.install_files('${SYSCONFDIR}/ndn', ['ndn-traffic-client.conf.sample',
42 'ndn-traffic-server.conf.sample'])
Davide Pesaventoe5a73942019-01-26 20:54:13 -050043
44 if Utils.unversioned_sys_platform() == 'linux':
45 systemd_units = bld.path.ant_glob('systemd/*.in')
46 bld(features='subst',
47 name='systemd-units',
48 source=systemd_units,
49 target=[u.change_ext('') for u in systemd_units])
Davide Pesaventoedd21842023-09-11 22:24:44 -040050
51def dist(ctx):
52 ctx.algo = 'tar.xz'
53
54def distcheck(ctx):
55 ctx.algo = 'tar.xz'