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 |
| 4 | import Logs |
| 5 | import Utils |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 6 | import Options |
| 7 | |
Alexander Afanasyev | 9de011f | 2011-11-11 00:55:05 -0800 | [diff] [blame] | 8 | from waflib.Errors import WafError |
| 9 | |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 10 | import wutils |
| 11 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 12 | def options(opt): |
| 13 | opt.tool_options('boost', tooldir=["waf-tools"]) |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 14 | opt.add_option('--enable-ndn-plugins', |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame^] | 15 | help=("Enable NDN plugins (may require patching). topology plugin enabled by default"), |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 16 | dest='enable_ndn_plugins') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 17 | |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame^] | 18 | opt.add_option('--disable-ndn-plugins', |
| 19 | help=("Enable NDN plugins (may require patching). topology plugin enabled by default"), |
| 20 | dest='disable_ndn_plugins') |
| 21 | |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 22 | def configure(conf): |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 23 | try: |
| 24 | conf.check_tool('boost') |
| 25 | conf.check_boost(lib = 'iostreams') |
| 26 | except WafError: |
| 27 | conf.env['LIB_BOOST'] = [] |
| 28 | |
| 29 | if not conf.env['LIB_BOOST']: |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 30 | conf.report_optional_feature("ndn-abstract", "NDN abstraction", False, |
| 31 | "Required boost libraries not found") |
| 32 | conf.env['ENABLE_NDN_ABSTRACT']=False; |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 33 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 34 | return |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 35 | |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame^] | 36 | conf.env['NDN_plugins'] = ['topology'] |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 37 | if Options.options.enable_ndn_plugins: |
Alexander Afanasyev | e8dab50 | 2012-11-21 16:17:51 -0800 | [diff] [blame^] | 38 | conf.env['NDN_plugins'] = conf.env['NDN_plugins'] + Options.options.enable_ndn_plugins.split(',') |
| 39 | |
| 40 | if Options.options.disable_ndn_plugins: |
| 41 | conf.env['NDN_plugins'] = conf.env['NDN_plugins'] - Options.options.disable_ndn_plugins.split(',') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 42 | |
| 43 | conf.env['ENABLE_NDN_ABSTRACT']=True; |
| 44 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 45 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 46 | def build(bld): |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 47 | deps = ['core', 'network', 'point-to-point'] |
| 48 | deps.append ('internet') # Until RttEstimator is moved to network module |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 49 | if bld.env['ENABLE_PYTHON_BINDINGS']: |
| 50 | deps.append ('visualizer') |
| 51 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 52 | if 'topology' in bld.env['NDN_plugins']: |
| 53 | deps.append ('topology-read') |
| 54 | |
Alexander Afanasyev | 4a3b2be | 2012-06-29 14:29:13 -0700 | [diff] [blame] | 55 | if 'mobility' in bld.env['NDN_plugins']: |
| 56 | deps.append ('mobility') |
| 57 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 58 | module = bld.create_ns3_module ('ndnSIM', deps) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 59 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 60 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 61 | headers = bld.new_task_gen(features=['ns3header']) |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 62 | headers.module = 'ndnSIM' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 63 | |
| 64 | if not bld.env['ENABLE_NDN_ABSTRACT']: |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 65 | bld.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 66 | return |
| 67 | |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 68 | module.source = bld.path.ant_glob(['model/**/*.cc', |
| 69 | 'apps/*.cc', |
Alexander Afanasyev | 1a2df6a | 2012-08-17 13:21:51 -0700 | [diff] [blame] | 70 | 'utils/**/*.cc', |
Alexander Afanasyev | e3d126f | 2012-07-16 17:07:31 -0700 | [diff] [blame] | 71 | 'helper/**/*.cc', |
| 72 | ]) |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 73 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 74 | headers.source = [ |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 75 | "helper/ndn-stack-helper.h", |
| 76 | "helper/ndn-app-helper.h", |
| 77 | "helper/ndn-header-helper.h", |
| 78 | "helper/ndn-face-container.h", |
| 79 | "helper/ndn-global-routing-helper.h", |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 80 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 81 | "apps/ndn-app.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 82 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 83 | "model/ndn-l3-protocol.h", |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 84 | "model/ndn-face.h", |
| 85 | "model/ndn-app-face.h", |
| 86 | "model/ndn-net-device-face.h", |
Alexander Afanasyev | bd9c18e | 2012-11-19 15:23:41 -0800 | [diff] [blame] | 87 | "model/ndn-interest.h", |
| 88 | "model/ndn-content-object.h", |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 89 | "model/ndn-name-components.h", |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 90 | |
| 91 | "model/cs/ndn-content-store.h", |
| 92 | |
| 93 | "model/fib/ndn-fib.h", |
| 94 | "model/fib/ndn-fib-entry.h", |
| 95 | |
| 96 | "model/pit/ndn-pit.h", |
| 97 | "model/pit/ndn-pit-entry.h", |
| 98 | "model/pit/ndn-pit-entry-incoming-face.h", |
| 99 | "model/pit/ndn-pit-entry-outgoing-face.h", |
| 100 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 101 | "model/fw/ndn-forwarding-strategy.h", |
Alexander Afanasyev | ed449cc | 2012-08-21 11:10:33 -0700 | [diff] [blame] | 102 | "model/fw/ndn-fw-tag.h", |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 103 | |
Alexander Afanasyev | f5c0774 | 2012-10-31 13:13:05 -0700 | [diff] [blame] | 104 | # "utils/batches.h", |
Alexander Afanasyev | ea9b3e6 | 2012-08-13 19:02:54 -0700 | [diff] [blame] | 105 | "utils/ndn-limits.h", |
Alexander Afanasyev | c1e33eb | 2012-05-31 12:13:17 -0700 | [diff] [blame] | 106 | # "utils/weights-path-stretch-tag.h", |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 107 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 108 | ] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 109 | |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 110 | if 'topology' in bld.env['NDN_plugins']: |
| 111 | headers.source.extend ([ |
| 112 | "plugins/topology/rocketfuel-weights-reader.h", |
| 113 | "plugins/topology/annotated-topology-reader.h", |
| 114 | ]) |
| 115 | module.source.extend (bld.path.ant_glob(['plugins/topology/*.cc'])) |
| 116 | |
| 117 | if 'mobility' in bld.env['NDN_plugins']: |
| 118 | headers.source.extend ([ |
| 119 | "plugins/mobility/spring-mobility-model.h", |
| 120 | "plugins/mobility/spring-mobility-helper.h", |
| 121 | ]) |
| 122 | module.source.extend (bld.path.ant_glob(['plugins/mobility/*.cc'])) |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 123 | |
| 124 | ndnSIM_headers = [p.path_from(bld.path) for p in bld.path.ant_glob([ |
| 125 | 'utils/**/*.h', |
| 126 | 'model/**/*.h', |
| 127 | 'apps/**/*.h', |
| 128 | 'helper/**/*.h', |
| 129 | ])] |
| 130 | bld.install_files('${INCLUDEDIR}/%s%s/ns3/ndnSIM' % (wutils.APPNAME, wutils.VERSION), ndnSIM_headers, relative_trick=True) |
| 131 | # bld.install_files('$PREFIX/include', ndnSIM_headers) |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 132 | |
Alexander Afanasyev | 5662b36 | 2012-07-11 13:34:21 -0700 | [diff] [blame] | 133 | tests = bld.create_ns3_module_test_library('ndnSIM') |
Alexander Afanasyev | a65ab32 | 2012-10-23 21:43:39 -0700 | [diff] [blame] | 134 | tests.source = bld.path.ant_glob('test/*.cc') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 135 | |
Alexander Afanasyev | f04d451 | 2012-02-14 18:42:47 -0800 | [diff] [blame] | 136 | if bld.env.ENABLE_EXAMPLES: |
| 137 | bld.add_subdirs('examples') |
Lucas | 64b8536 | 2012-01-30 16:28:37 -0800 | [diff] [blame] | 138 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 139 | bld.ns3_python_bindings() |