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; -*- |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 2 | # |
Alexander Afanasyev | c9f2e25 | 2013-07-14 15:35:21 -0700 | [diff] [blame] | 3 | # Copyright (c) 2011-2013, Regents of the University of California |
| 4 | # Alexander Afanasyev |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 5 | # |
Alexander Afanasyev | c9f2e25 | 2013-07-14 15:35:21 -0700 | [diff] [blame] | 6 | # GNU 3.0 license, See the LICENSE file for more information |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 7 | # |
Alexander Afanasyev | c9f2e25 | 2013-07-14 15:35:21 -0700 | [diff] [blame] | 8 | # Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 9 | # |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 10 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 11 | import os |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 12 | from waflib import Logs, Utils, Options, TaskGen, Task |
Alexander Afanasyev | 9de011f | 2011-11-11 00:55:05 -0800 | [diff] [blame] | 13 | from waflib.Errors import WafError |
| 14 | |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 15 | import wutils |
| 16 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 17 | def options(opt): |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 18 | opt = opt.add_option_group ('ndnSIM Options') |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 19 | opt.add_option('--enable-ndn-plugins', |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 20 | help="""Enable NDN plugins (may require patching). topology plugin enabled by default""", |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 21 | dest='enable_ndn_plugins') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame] | 23 | opt.add_option('--disable-ndn-plugins', |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 24 | help="""Enable NDN plugins (may require patching). topology plugin enabled by default""", |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame] | 25 | dest='disable_ndn_plugins') |
| 26 | |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 27 | opt.add_option('--pyndn-install-path', dest='pyndn_install_path', |
| 28 | help="""Installation path for PyNDN (by default: into standard location under PyNDN folder""") |
| 29 | |
Alexander Afanasyev | b66a89b | 2013-05-05 00:20:12 -0700 | [diff] [blame] | 30 | REQUIRED_BOOST_LIBS = ['graph'] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 31 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 32 | def required_boost_libs(conf): |
| 33 | conf.env.REQUIRED_BOOST_LIBS += REQUIRED_BOOST_LIBS |
| 34 | |
| 35 | def configure(conf): |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 36 | conf.env['ENABLE_NDNSIM']=False; |
| 37 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 38 | if not conf.env['LIB_BOOST']: |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 39 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 40 | "Required boost libraries not found") |
Alexander Afanasyev | b66a89b | 2013-05-05 00:20:12 -0700 | [diff] [blame] | 41 | Logs.error ("ndnSIM will not be build as it requires boost libraries of version at least 1.46") |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 42 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 43 | return |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 44 | else: |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 45 | present_boost_libs = [] |
| 46 | for boost_lib_name in conf.env['LIB_BOOST']: |
| 47 | if boost_lib_name.startswith("boost_"): |
| 48 | boost_lib_name = boost_lib_name[6:] |
| 49 | if boost_lib_name.endswith("-mt"): |
| 50 | boost_lib_name = boost_lib_name[:-3] |
Alexander Afanasyev | cd38c84 | 2013-05-05 00:24:41 -0700 | [diff] [blame] | 51 | present_boost_libs.append(boost_lib_name) |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 52 | |
| 53 | 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] | 54 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 55 | if missing_boost_libs != []: |
| 56 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
| 57 | "ndnSIM requires boost libraries: %s" % ' '.join(missing_boost_libs)) |
| 58 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
| 59 | |
| 60 | Logs.error ("ndnSIM will not be build as it requires boost libraries: %s" % ' '.join(missing_boost_libs)) |
| 61 | Logs.error ("Please upgrade your distribution or install custom boost libraries (http://ndnsim.net/faq.html#boost-libraries)") |
| 62 | return |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 63 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 64 | boost_version = conf.env.BOOST_VERSION.split('_') |
Alexander Afanasyev | b66a89b | 2013-05-05 00:20:12 -0700 | [diff] [blame] | 65 | if int(boost_version[0]) < 1 or int(boost_version[1]) < 46: |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 66 | conf.report_optional_feature("ndnSIM", "ndnSIM", False, |
Alexander Afanasyev | b66a89b | 2013-05-05 00:20:12 -0700 | [diff] [blame] | 67 | "ndnSIM requires at least boost version 1.46") |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 68 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
| 69 | |
Alexander Afanasyev | b66a89b | 2013-05-05 00:20:12 -0700 | [diff] [blame] | 70 | Logs.error ("ndnSIM will not be build as it requires boost libraries of version at least 1.46") |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 71 | Logs.error ("Please upgrade your distribution or install custom boost libraries (http://ndnsim.net/faq.html#boost-libraries)") |
| 72 | return |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 73 | |
Alexander Afanasyev | f4e2452 | 2013-06-24 14:11:57 -0700 | [diff] [blame] | 74 | conf.env['NDN_plugins'] = ['topology', 'ip-faces'] |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 75 | if Options.options.enable_ndn_plugins: |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame] | 76 | conf.env['NDN_plugins'] = conf.env['NDN_plugins'] + Options.options.enable_ndn_plugins.split(',') |
| 77 | |
| 78 | if Options.options.disable_ndn_plugins: |
| 79 | conf.env['NDN_plugins'] = conf.env['NDN_plugins'] - Options.options.disable_ndn_plugins.split(',') |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 80 | |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 81 | if Options.options.pyndn_install_path: |
| 82 | conf.env['PyNDN_install_path'] = Options.options.pyndn_install_path |
| 83 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 84 | conf.env['ENABLE_NDNSIM']=True; |
| 85 | conf.env['MODULES_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 86 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 87 | conf.report_optional_feature("ndnSIM", "ndnSIM", True, "") |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 88 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 89 | def build(bld): |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 90 | deps = ['core', 'network', 'point-to-point'] |
| 91 | deps.append ('internet') # Until RttEstimator is moved to network module |
Alexander Afanasyev | c141ec0 | 2013-07-27 11:44:04 -0700 | [diff] [blame] | 92 | if 'visualizer' in bld.env['NS3_ENABLED_MODULES']: |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 93 | deps.append ('visualizer') |
| 94 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 95 | if 'topology' in bld.env['NDN_plugins']: |
| 96 | deps.append ('topology-read') |
Alexander Afanasyev | 7d8127a | 2012-11-26 00:33:10 -0800 | [diff] [blame] | 97 | deps.append ('mobility') |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 98 | |
Alexander Afanasyev | 4a3b2be | 2012-06-29 14:29:13 -0700 | [diff] [blame] | 99 | if 'mobility' in bld.env['NDN_plugins']: |
| 100 | deps.append ('mobility') |
| 101 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 102 | module = bld.create_ns3_module ('ndnSIM', deps) |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 103 | module.module = 'ndnSIM' |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 104 | module.features += ' ns3fullmoduleheaders' |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 105 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 106 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 107 | headers = bld (features='ns3header') |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 108 | headers.module = 'ndnSIM' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 109 | |
Alexander Afanasyev | 1bfce32 | 2012-11-23 21:38:02 -0800 | [diff] [blame] | 110 | if not bld.env['ENABLE_NDNSIM']: |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 111 | bld.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 112 | return |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 113 | |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 114 | module.source = bld.path.ant_glob(['model/**/*.cc', |
| 115 | 'apps/*.cc', |
Alexander Afanasyev | 1a2df6a | 2012-08-17 13:21:51 -0700 | [diff] [blame] | 116 | 'utils/**/*.cc', |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 117 | 'helper/**/*.cc', |
Alexander Afanasyev | 7960606 | 2013-07-11 00:57:28 -0700 | [diff] [blame] | 118 | 'ndn.cxx/**/*.cc', |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 119 | ]) |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 120 | module.full_headers = [p.path_from(bld.path) for p in bld.path.ant_glob([ |
| 121 | 'utils/**/*.h', |
| 122 | 'model/**/*.h', |
| 123 | 'apps/**/*.h', |
| 124 | 'helper/**/*.h', |
Alexander Afanasyev | 7960606 | 2013-07-11 00:57:28 -0700 | [diff] [blame] | 125 | 'ndn.cxx/**/*.h', |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 126 | ])] |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 127 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 128 | headers.source = [ |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 129 | "helper/ndn-stack-helper.h", |
| 130 | "helper/ndn-app-helper.h", |
| 131 | "helper/ndn-header-helper.h", |
| 132 | "helper/ndn-face-container.h", |
| 133 | "helper/ndn-global-routing-helper.h", |
Alexander Afanasyev | 0fb80b9 | 2013-07-20 08:20:50 -0700 | [diff] [blame] | 134 | "helper/ndn-link-control-helper.h", |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 135 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 136 | "apps/ndn-app.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 137 | |
Alexander Afanasyev | 1043c70 | 2013-07-15 16:21:09 -0700 | [diff] [blame] | 138 | "model/ndn-common.h", |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 139 | "model/ndn-l3-protocol.h", |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 140 | "model/ndn-face.h", |
| 141 | "model/ndn-app-face.h", |
| 142 | "model/ndn-net-device-face.h", |
Alexander Afanasyev | bd9c18e | 2012-11-19 15:23:41 -0800 | [diff] [blame] | 143 | "model/ndn-interest.h", |
Alexander Afanasyev | 6eba36f | 2013-08-07 17:42:54 -0700 | [diff] [blame] | 144 | "model/ndn-data.h", |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 145 | "model/ndn-name-components.h", |
Alexander Afanasyev | 32c0756 | 2013-02-01 12:58:43 -0800 | [diff] [blame] | 146 | "model/ndn-name.h", |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 147 | |
Alexander Afanasyev | 9213601 | 2013-07-16 20:36:30 -0700 | [diff] [blame] | 148 | "ndn.cxx/blob.h", |
Alexander Afanasyev | f23a7b6 | 2013-07-17 13:22:25 -0700 | [diff] [blame] | 149 | "ndn.cxx/name-component.h", |
| 150 | "ndn.cxx/name.h", |
Alexander Afanasyev | 9213601 | 2013-07-16 20:36:30 -0700 | [diff] [blame] | 151 | "ndn.cxx/exclude.h", |
| 152 | "ndn.cxx/ndn-api-face.h", |
| 153 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 154 | "model/cs/ndn-content-store.h", |
| 155 | |
| 156 | "model/fib/ndn-fib.h", |
| 157 | "model/fib/ndn-fib-entry.h", |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 158 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 159 | "model/pit/ndn-pit.h", |
| 160 | "model/pit/ndn-pit-entry.h", |
| 161 | "model/pit/ndn-pit-entry-incoming-face.h", |
| 162 | "model/pit/ndn-pit-entry-outgoing-face.h", |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 163 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 164 | "model/fw/ndn-forwarding-strategy.h", |
Alexander Afanasyev | ed449cc | 2012-08-21 11:10:33 -0700 | [diff] [blame] | 165 | "model/fw/ndn-fw-tag.h", |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 166 | |
Alexander Afanasyev | 7b923f3 | 2013-07-16 13:23:04 -0700 | [diff] [blame] | 167 | "model/wire/ndn-wire.h", |
Alexander Afanasyev | 1043c70 | 2013-07-15 16:21:09 -0700 | [diff] [blame] | 168 | |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 169 | "utils/ndn-limits.h", |
Alexander Afanasyev | d9a7f19 | 2013-03-07 13:58:14 -0800 | [diff] [blame] | 170 | "utils/ndn-rtt-estimator.h", |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 171 | |
Alexander Afanasyev | e4795ae | 2013-07-11 20:01:31 -0700 | [diff] [blame] | 172 | "apps/callback-based-app.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 173 | ] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 174 | |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 175 | if 'topology' in bld.env['NDN_plugins']: |
| 176 | headers.source.extend ([ |
| 177 | "plugins/topology/rocketfuel-weights-reader.h", |
| 178 | "plugins/topology/annotated-topology-reader.h", |
| 179 | ]) |
| 180 | module.source.extend (bld.path.ant_glob(['plugins/topology/*.cc'])) |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 181 | module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/topology/**/*.h'])]) |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 182 | |
| 183 | if 'mobility' in bld.env['NDN_plugins']: |
| 184 | headers.source.extend ([ |
| 185 | "plugins/mobility/spring-mobility-model.h", |
| 186 | "plugins/mobility/spring-mobility-helper.h", |
| 187 | ]) |
| 188 | module.source.extend (bld.path.ant_glob(['plugins/mobility/*.cc'])) |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 189 | module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/mobility/**/*.h'])]) |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 190 | |
Alexander Afanasyev | f4e2452 | 2013-06-24 14:11:57 -0700 | [diff] [blame] | 191 | if 'ip-faces' in bld.env['NDN_plugins']: |
| 192 | headers.source.extend ([ |
| 193 | "plugins/ip-faces/ndn-ip-faces-helper.h", |
| 194 | ]) |
| 195 | module.source.extend (bld.path.ant_glob(['plugins/ip-faces/*.cc'])) |
| 196 | module.full_headers.extend ([p.path_from(bld.path) for p in bld.path.ant_glob(['plugins/ip-faces/**/*.h'])]) |
| 197 | |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 198 | # bld.install_files('${INCLUDEDIR}/%s%s/ns3/ndnSIM' % (wutils.APPNAME, wutils.VERSION), ndnSIM_headers, relative_trick=True) |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 199 | # bld.install_files('$PREFIX/include', ndnSIM_headers) |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 200 | |
Alexander Afanasyev | 5662b36 | 2012-07-11 13:34:21 -0700 | [diff] [blame] | 201 | tests = bld.create_ns3_module_test_library('ndnSIM') |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 202 | tests.source = bld.path.ant_glob('test/*.cc') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 203 | |
Alexander Afanasyev | f04d451 | 2012-02-14 18:42:47 -0800 | [diff] [blame] | 204 | if bld.env.ENABLE_EXAMPLES: |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 205 | bld.recurse ('examples') |
Lucas | 64b8536 | 2012-01-30 16:28:37 -0800 | [diff] [blame] | 206 | |
Alexander Afanasyev | 152660b | 2013-01-08 09:33:05 -0800 | [diff] [blame] | 207 | bld.recurse ('tools') |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 208 | |
Alexander Afanasyev | 76b1157 | 2013-07-16 21:49:50 -0700 | [diff] [blame] | 209 | bld.ns3_python_bindings() |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 210 | |
Alexander Afanasyev | b4921ec | 2013-08-07 17:45:01 -0700 | [diff] [blame] | 211 | if bld.env['PyNDN_install_path']: |
| 212 | bld (features = "py", |
| 213 | source = bld.path.ant_glob (["PyNDN/**/*.py"]), |
| 214 | install_from = "PyNDN", |
| 215 | install_path = bld.env['PyNDN_install_path']) |
| 216 | else: |
| 217 | bld (features = "py", |
| 218 | source = bld.path.ant_glob (["PyNDN/**/*.py"]), |
| 219 | install_from = ".") |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 220 | |
| 221 | @TaskGen.feature('ns3fullmoduleheaders') |
| 222 | @TaskGen.after_method('process_rule') |
| 223 | def apply_ns3fullmoduleheaders(self): |
| 224 | # ## get all of the ns3 headers |
Alexander Afanasyev | 1a62e61 | 2013-05-02 16:50:48 -0700 | [diff] [blame] | 225 | ns3_dir_node = self.bld.path.find_or_declare("ns3") |
Alexander Afanasyev | 5931480 | 2012-11-26 14:56:04 -0800 | [diff] [blame] | 226 | |
| 227 | mode = getattr(self, "mode", "install") |
| 228 | |
| 229 | for filename in set(self.to_list(self.full_headers)): |
| 230 | src_node = self.path.find_resource(filename) |
| 231 | if src_node is None: |
| 232 | raise WafError("source ns3 header file %s not found" % (filename,)) |
| 233 | dst_node = ns3_dir_node.find_or_declare(src_node.path_from(self.bld.path.find_dir('src'))) |
| 234 | assert dst_node is not None |
| 235 | |
| 236 | relpath = src_node.parent.path_from(self.bld.path.find_dir('src')) |
| 237 | |
| 238 | task = self.create_task('ns3header') |
| 239 | task.mode = getattr(self, 'mode', 'install') |
| 240 | if task.mode == 'install': |
Alexander Afanasyev | 957a84a | 2013-01-23 10:21:06 -0800 | [diff] [blame] | 241 | 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] | 242 | [src_node]) |
| 243 | task.set_inputs([src_node]) |
| 244 | task.set_outputs([dst_node]) |
| 245 | else: |
| 246 | task.header_to_remove = dst_node |
| 247 | |