Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 1 | ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 3 | import os |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 4 | from waflib import Logs, Utils, Options, TaskGen, Task |
Alexander Afanasyev | 9de011f | 2011-11-11 00:55:05 -0800 | [diff] [blame] | 5 | from waflib.Errors import WafError |
| 6 | |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 7 | import wutils |
| 8 | |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 9 | REQUIRED_BOOST_LIBS = ['graph', 'thread', 'unit_test_framework', |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 10 | 'system', 'random', 'date_time', 'iostreams', 'regex', |
| 11 | 'program_options', 'chrono', 'filesystem'] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 12 | |
Alexander Afanasyev | 0492f87 | 2019-07-31 13:48:17 -0400 | [diff] [blame] | 13 | top = '../..' |
| 14 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 15 | def required_boost_libs(conf): |
| 16 | conf.env.REQUIRED_BOOST_LIBS += REQUIRED_BOOST_LIBS |
| 17 | |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame] | 18 | def options(opt): |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 19 | opt.load(['version'], tooldir=['%s/.waf-tools' % opt.path.abspath()]) |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 20 | opt.load(['doxygen', 'sphinx_build', 'compiler-features', 'sqlite3', 'openssl'], |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 21 | tooldir=['%s/ndn-cxx/.waf-tools' % opt.path.abspath()]) |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame] | 22 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 23 | def configure(conf): |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 24 | conf.load(['doxygen', 'sphinx_build', 'compiler-features', 'version', 'sqlite3', 'openssl']) |
Alexander Afanasyev | 8e60bcd | 2015-01-15 20:55:40 +0000 | [diff] [blame] | 25 | |
| 26 | conf.env['ENABLE_NDNSIM']=False |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 27 | |
Alexander Afanasyev | e932a21 | 2018-03-11 12:40:07 -0400 | [diff] [blame] | 28 | if 'PKG_CONFIG_PATH' not in os.environ: |
| 29 | os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env) |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 30 | |
| 31 | conf.check_cxx(lib='pthread', uselib_store='PTHREAD', define_name='HAVE_PTHREAD', mandatory=False) |
| 32 | conf.check_sqlite3(mandatory=True) |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 33 | conf.check_openssl(mandatory=True, use='OPENSSL', atleast_version='1.1.1') |
Alexander Afanasyev | 60c0462 | 2014-12-29 20:43:22 -0800 | [diff] [blame] | 34 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 35 | if not conf.env['LIB_BOOST']: |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 36 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 37 | "Required boost libraries not found") |
Spyridon Mastorakis | f6d3285 | 2017-09-27 20:28:52 -0700 | [diff] [blame] | 38 | Logs.error ("ndnSIM will not be built as it requires boost libraries of version at least 1.54.0") |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 39 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 40 | return |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 41 | else: |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 42 | present_boost_libs = [] |
| 43 | for boost_lib_name in conf.env['LIB_BOOST']: |
| 44 | if boost_lib_name.startswith("boost_"): |
| 45 | boost_lib_name = boost_lib_name[6:] |
| 46 | if boost_lib_name.endswith("-mt"): |
| 47 | boost_lib_name = boost_lib_name[:-3] |
Alexander Afanasyev | cd38c84 | 2013-05-05 00:24:41 -0700 | [diff] [blame] | 48 | present_boost_libs.append(boost_lib_name) |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 49 | |
| 50 | missing_boost_libs = [lib for lib in REQUIRED_BOOST_LIBS if lib not in present_boost_libs] |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 51 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 52 | if missing_boost_libs != []: |
| 53 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
| 54 | "ndnSIM requires boost libraries: %s" % ' '.join(missing_boost_libs)) |
| 55 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
| 56 | |
| 57 | Logs.error ("ndnSIM will not be build as it requires boost libraries: %s" % ' '.join(missing_boost_libs)) |
| 58 | Logs.error ("Please upgrade your distribution or install custom boost libraries (http://ndnsim.net/faq.html#boost-libraries)") |
| 59 | return |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 60 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 61 | boost_version = conf.env.BOOST_VERSION.split('_') |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 62 | if int(boost_version[0]) < 1 or int(boost_version[1]) < 54: |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 63 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 64 | "ndnSIM requires at least boost version 1.54") |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 65 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
| 66 | |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 67 | Logs.error ("ndnSIM will not be build as it requires boost libraries of version at least 1.54") |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 68 | Logs.error ("Please upgrade your distribution or install custom boost libraries (http://ndnsim.net/faq.html#boost-libraries)") |
| 69 | return |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 70 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 71 | conf.env['ENABLE_NDNSIM']=True; |
| 72 | conf.env['MODULES_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 73 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 74 | conf.report_optional_feature("ndnSIM", "ndnSIM", True, "") |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 75 | |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 76 | conf.write_config_header('../../ns3/ndnSIM/ndn-cxx/detail/config.hpp', define_prefix='NDN_CXX_', remove=False) |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 77 | conf.write_config_header('../../ns3/ndnSIM/NFD/core/config.hpp', remove=False) |
Spyridon Mastorakis | a1d135b | 2015-08-20 20:24:59 -0700 | [diff] [blame] | 78 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 79 | def build(bld): |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 80 | (base, build, VERSION_SPLIT) = bld.getVersion('NFD') |
| 81 | |
| 82 | vmajor = int(VERSION_SPLIT[0]) |
| 83 | vminor = int(VERSION_SPLIT[1]) if len(VERSION_SPLIT) >= 2 else 0 |
| 84 | vpatch = int(VERSION_SPLIT[2]) if len(VERSION_SPLIT) >= 3 else 0 |
| 85 | |
Spyridon Mastorakis | a1d135b | 2015-08-20 20:24:59 -0700 | [diff] [blame] | 86 | bld(features="subst", |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 87 | name="version-NFD", |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 88 | source='NFD/core/version.hpp.in', target='../../ns3/ndnSIM/NFD/core/version.hpp', |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 89 | install_path=None, |
| 90 | VERSION_STRING=base, |
| 91 | VERSION_BUILD="%s-ndnSIM" % build, |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 92 | VERSION=vmajor * 1000000 + vminor * 1000 + vpatch, |
| 93 | VERSION_MAJOR=str(vmajor), |
| 94 | VERSION_MINOR=str(vminor), |
| 95 | VERSION_PATCH=str(vpatch)) |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 96 | |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 97 | bld(features="subst", |
| 98 | name="versioncpp-NFD", |
Alexander Afanasyev | 0492f87 | 2019-07-31 13:48:17 -0400 | [diff] [blame] | 99 | source='NFD/core/version.cpp.in', target=bld.path.find_or_declare('NFD/core/version.cpp'), |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 100 | install_path=None, |
| 101 | VERSION_STRING=base, |
| 102 | VERSION_BUILD="%s-ndnSIM" % build, |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 103 | VERSION=vmajor * 1000000 + vminor * 1000 + vpatch, |
| 104 | VERSION_MAJOR=str(vmajor), |
| 105 | VERSION_MINOR=str(vminor), |
| 106 | VERSION_PATCH=str(vpatch)) |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 107 | |
Alexander Afanasyev | 0492f87 | 2019-07-31 13:48:17 -0400 | [diff] [blame] | 108 | bld.objects( |
| 109 | features="cxx", |
| 110 | target='version-NFD-objects', |
| 111 | source='NFD/core/version.cpp', |
| 112 | includes='../../ns3/ndnSIM/NFD', |
| 113 | use='version-NFD versioncpp-NFD') |
| 114 | |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 115 | (base, build, VERSION_SPLIT) = bld.getVersion('ndn-cxx') |
| 116 | vmajor = int(VERSION_SPLIT[0]) |
| 117 | vminor = int(VERSION_SPLIT[1]) if len(VERSION_SPLIT) >= 2 else 0 |
| 118 | vpatch = int(VERSION_SPLIT[2]) if len(VERSION_SPLIT) >= 3 else 0 |
| 119 | |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 120 | bld(features="subst", |
| 121 | name="version-ndn-cxx", |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 122 | source='ndn-cxx/ndn-cxx/version.hpp.in', target='../../ns3/ndnSIM/ndn-cxx/version.hpp', |
Spyridon Mastorakis | a1d135b | 2015-08-20 20:24:59 -0700 | [diff] [blame] | 123 | install_path=None, |
| 124 | VERSION_STRING=base, |
| 125 | VERSION_BUILD="%s-ndnSIM" % build, |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 126 | VERSION=vmajor * 1000000 + vminor * 1000 + vpatch, |
| 127 | VERSION_MAJOR=str(vmajor), |
| 128 | VERSION_MINOR=str(vminor), |
| 129 | VERSION_PATCH=str(vpatch)) |
Spyridon Mastorakis | a1d135b | 2015-08-20 20:24:59 -0700 | [diff] [blame] | 130 | |
Alexander Afanasyev | 60c0462 | 2014-12-29 20:43:22 -0800 | [diff] [blame] | 131 | deps = ['core', 'network', 'point-to-point', 'topology-read', 'mobility', 'internet'] |
Alexander Afanasyev | 0d584e3 | 2013-08-13 10:41:42 -0700 | [diff] [blame] | 132 | if 'ns3-visualizer' in bld.env['NS3_ENABLED_MODULES']: |
Alexander Afanasyev | 60c0462 | 2014-12-29 20:43:22 -0800 | [diff] [blame] | 133 | deps.append('visualizer') |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 134 | |
Alexander Afanasyev | 60c0462 | 2014-12-29 20:43:22 -0800 | [diff] [blame] | 135 | if bld.env.ENABLE_EXAMPLES: |
Alexander Afanasyev | 15db772 | 2015-01-19 17:27:26 -0800 | [diff] [blame] | 136 | deps += ['point-to-point-layout', 'csma', 'applications', 'wifi'] |
Alexander Afanasyev | 4a3b2be | 2012-06-29 14:29:13 -0700 | [diff] [blame] | 137 | |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 138 | ndnCxxSrc = bld.path.ant_glob('ndn-cxx/ndn-cxx/**/*.cpp', |
| 139 | excl=['ndn-cxx/ndn-cxx/net/impl/*.cpp', |
| 140 | 'ndn-cxx/ndn-cxx/net/network-monitor*.cpp', |
| 141 | 'ndn-cxx/ndn-cxx/util/dummy-client-face.cpp', |
Alexander Afanasyev | 59090db | 2020-02-21 16:37:43 -0500 | [diff] [blame] | 142 | 'ndn-cxx/ndn-cxx/**/*osx.cpp', |
Alexander Afanasyev | f007a99 | 2022-05-05 15:57:08 -0400 | [diff] [blame] | 143 | 'ndn-cxx/ndn-cxx/net/network-interface.cpp', |
| 144 | 'ndn-cxx/**/*-android.cpp']) |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 145 | |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 146 | nfdSrc = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in ['NFD/core', 'NFD/daemon']], |
Alexander Afanasyev | 325c253 | 2016-09-08 15:38:53 -0700 | [diff] [blame] | 147 | excl=['NFD/daemon/main.cpp', |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 148 | 'NFD/daemon/nfd.cpp', |
Spyridon Mastorakis | f6d3285 | 2017-09-27 20:28:52 -0700 | [diff] [blame] | 149 | 'NFD/daemon/face/*ethernet*', |
| 150 | 'NFD/daemon/face/*pcap*.cpp', |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 151 | 'NFD/daemon/face/tcp*', |
Alexander Afanasyev | 325c253 | 2016-09-08 15:38:53 -0700 | [diff] [blame] | 152 | 'NFD/daemon/face/*udp*', |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 153 | 'NFD/daemon/face/unix-stream*', |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 154 | 'NFD/daemon/face/websocket*']) |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 155 | |
| 156 | module = bld.create_ns3_module('ndnSIM', deps) |
| 157 | module.module = 'ndnSIM' |
| 158 | module.features += ' ns3fullmoduleheaders ndncxxheaders' |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 159 | module.use += ['version-ndn-cxx', 'version-NFD-objects', 'BOOST', 'SQLITE3', 'RT', 'PTHREAD', 'OPENSSL'] |
Spyridon Mastorakis | 8fde22b | 2015-08-19 23:12:44 -0700 | [diff] [blame] | 160 | module.includes = ['../..', '../../ns3/ndnSIM/NFD', './NFD/core', './NFD/daemon', './NFD/rib', '../../ns3/ndnSIM', '../../ns3/ndnSIM/ndn-cxx'] |
| 161 | module.export_includes = ['../../ns3/ndnSIM/NFD', './NFD/core', './NFD/daemon', './NFD/rib', '../../ns3/ndnSIM'] |
Alexander Afanasyev | 6995bb7 | 2019-02-23 15:53:26 -0500 | [diff] [blame] | 162 | if 'ns3-visualizer' in bld.env['NS3_ENABLED_MODULES']: |
| 163 | module.defines = ['HAVE_NS3_VISUALIZER=1'] |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 164 | |
| 165 | headers = bld(features='ns3header') |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 166 | headers.module = 'ndnSIM' |
Alexander Afanasyev | 60c0462 | 2014-12-29 20:43:22 -0800 | [diff] [blame] | 167 | headers.source = ["ndn-all.hpp"] |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 168 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 169 | if not bld.env['ENABLE_NDNSIM']: |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 170 | bld.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 171 | return |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 172 | |
Spyridon Mastorakis | b0b2241 | 2016-12-07 14:33:46 -0800 | [diff] [blame] | 173 | module_dirs = ['apps', 'helper', 'model', 'utils', 'bindings'] |
Spyridon Mastorakis | e4f0d3c | 2014-10-29 13:20:03 -0700 | [diff] [blame] | 174 | module.source = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in module_dirs], |
Alexander Afanasyev | 325c253 | 2016-09-08 15:38:53 -0700 | [diff] [blame] | 175 | excl=[ |
Alexander Afanasyev | 325c253 | 2016-09-08 15:38:53 -0700 | [diff] [blame] | 176 | 'model/ip-faces/*']) + ndnCxxSrc + nfdSrc |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 177 | |
Alexander Afanasyev | 11dfcb7 | 2019-07-27 17:47:32 -0400 | [diff] [blame] | 178 | module_dirs = ['NFD/core', 'NFD/daemon', 'apps', 'helper', 'model', 'utils', 'bindings'] |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 179 | module.full_headers = bld.path.ant_glob(['%s/**/*.hpp' % dir for dir in module_dirs]) |
| 180 | module.full_headers += bld.path.ant_glob('NFD/common.hpp') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 181 | |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 182 | module.ndncxx_headers = bld.path.ant_glob(['ndn-cxx/ndn-cxx/**/*.hpp'], |
| 183 | excl=['src/**/*-osx.hpp', 'src/impl/**/*']) |
Spyridon Mastorakis | f6d3285 | 2017-09-27 20:28:52 -0700 | [diff] [blame] | 184 | |
Alexander Afanasyev | 50ea1a3 | 2016-09-08 15:44:08 -0700 | [diff] [blame] | 185 | if bld.env.ENABLE_EXAMPLES: |
| 186 | bld.recurse('examples') |
Lucas | 64b8536 | 2012-01-30 16:28:37 -0800 | [diff] [blame] | 187 | |
Spyridon Mastorakis | b4bd4b7 | 2015-01-05 17:41:12 -0800 | [diff] [blame] | 188 | if bld.env.ENABLE_TESTS: |
| 189 | bld.recurse('tests') |
| 190 | |
Alexander Afanasyev | c018a56 | 2016-09-08 16:27:31 -0700 | [diff] [blame] | 191 | bld.ns3_python_bindings() |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 192 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 193 | @TaskGen.feature('ns3fullmoduleheaders') |
| 194 | @TaskGen.after_method('process_rule') |
| 195 | def apply_ns3fullmoduleheaders(self): |
| 196 | # ## get all of the ns3 headers |
Alexander Afanasyev | 1a62e61 | 2013-05-02 16:50:48 -0700 | [diff] [blame] | 197 | ns3_dir_node = self.bld.path.find_or_declare("ns3") |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 198 | |
| 199 | mode = getattr(self, "mode", "install") |
| 200 | |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 201 | for src_node in set(self.full_headers): |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 202 | dst_node = ns3_dir_node.find_or_declare(src_node.path_from(self.bld.path.find_dir('src'))) |
| 203 | assert dst_node is not None |
| 204 | |
| 205 | relpath = src_node.parent.path_from(self.bld.path.find_dir('src')) |
| 206 | |
| 207 | task = self.create_task('ns3header') |
| 208 | task.mode = getattr(self, 'mode', 'install') |
| 209 | if task.mode == 'install': |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 210 | self.bld.install_files('${INCLUDEDIR}/%s%s/ns3/%s' % (wutils.APPNAME, wutils.VERSION, relpath), |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 211 | [src_node]) |
| 212 | task.set_inputs([src_node]) |
| 213 | task.set_outputs([dst_node]) |
| 214 | else: |
| 215 | task.header_to_remove = dst_node |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 216 | |
| 217 | @TaskGen.feature('ndncxxheaders') |
| 218 | @TaskGen.after_method('process_rule') |
| 219 | def apply_ndnsim_moduleheaders(self): |
| 220 | # ## get all of the ns3 headers |
| 221 | ndncxx_dir_node = self.bld.path.find_or_declare("ns3/ndnSIM/ndn-cxx") |
| 222 | |
| 223 | mode = getattr(self, "mode", "install") |
| 224 | |
| 225 | for src_node in set(self.ndncxx_headers): |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 226 | dst_node = ndncxx_dir_node.find_or_declare(src_node.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/ndn-cxx'))) |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 227 | assert dst_node is not None |
| 228 | |
Alexander Afanasyev | dc3c3a3 | 2019-02-17 20:17:32 -0500 | [diff] [blame] | 229 | relpath = src_node.parent.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/ndn-cxx')) |
Spyridon Mastorakis | f542c0b | 2015-08-11 22:59:18 -0700 | [diff] [blame] | 230 | |
| 231 | task = self.create_task('ns3header') |
| 232 | task.mode = getattr(self, 'mode', 'install') |
| 233 | if task.mode == 'install': |
| 234 | self.bld.install_files('${INCLUDEDIR}/%s%s/ns3/ndnSIM/ndn-cxx/%s' % (wutils.APPNAME, wutils.VERSION, relpath), |
| 235 | [src_node]) |
| 236 | task.set_inputs([src_node]) |
| 237 | task.set_outputs([dst_node]) |
| 238 | else: |
| 239 | task.header_to_remove = dst_node |