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 | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 10 | def options(opt): |
| 11 | opt.tool_options('boost', tooldir=["waf-tools"]) |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 12 | opt.add_option('--enable-ndn-plugins', |
| 13 | help=("Enable NDN plugins (may require patching)"), |
| 14 | dest='enable_ndn_plugins') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 15 | |
| 16 | def configure(conf): |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 17 | try: |
| 18 | conf.check_tool('boost') |
| 19 | conf.check_boost(lib = 'iostreams') |
| 20 | except WafError: |
| 21 | conf.env['LIB_BOOST'] = [] |
| 22 | |
| 23 | if not conf.env['LIB_BOOST']: |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 24 | conf.report_optional_feature("ndn-abstract", "NDN abstraction", False, |
| 25 | "Required boost libraries not found") |
| 26 | conf.env['ENABLE_NDN_ABSTRACT']=False; |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 27 | conf.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 28 | return |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 29 | |
| 30 | conf.env['NDN_plugins'] = [] |
| 31 | if Options.options.enable_ndn_plugins: |
| 32 | conf.env['NDN_plugins'] = Options.options.enable_ndn_plugins.split(',') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 33 | |
| 34 | conf.env['ENABLE_NDN_ABSTRACT']=True; |
| 35 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 36 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 37 | def build(bld): |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 38 | deps = ['core', 'network', 'point-to-point'] |
| 39 | deps.append ('internet') # Until RttEstimator is moved to network module |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 40 | if bld.env['ENABLE_PYTHON_BINDINGS']: |
| 41 | deps.append ('visualizer') |
| 42 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 43 | if 'topology' in bld.env['NDN_plugins']: |
| 44 | deps.append ('topology-read') |
| 45 | |
Alexander Afanasyev | 4a3b2be | 2012-06-29 14:29:13 -0700 | [diff] [blame^] | 46 | if 'mobility' in bld.env['NDN_plugins']: |
| 47 | deps.append ('mobility') |
| 48 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 49 | module = bld.create_ns3_module ('ndnSIM', deps) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 50 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 51 | |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 52 | tests = bld.create_ns3_module_test_library('ndnSIM') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 53 | headers = bld.new_task_gen(features=['ns3header']) |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 54 | headers.module = 'ndnSIM' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 55 | |
| 56 | if not bld.env['ENABLE_NDN_ABSTRACT']: |
Alexander Afanasyev | 57bcbc3 | 2012-06-01 01:46:24 -0700 | [diff] [blame] | 57 | bld.env['MODULES_NOT_BUILT'].append('ndnSIM') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 58 | return |
| 59 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 60 | module.source = bld.path.ant_glob(['model/*.cc', 'apps/*.cc', |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 61 | 'utils/*.cc', |
| 62 | 'helper/*.cc', |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 63 | 'helper/tracers/*.cc', |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 64 | 'helper/ccnb-parser/*.cc', |
| 65 | 'helper/ccnb-parser/visitors/*.cc', |
| 66 | 'helper/ccnb-parser/syntax-tree/*.cc']) |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 67 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 68 | headers.source = [ |
| 69 | "helper/ccnx-stack-helper.h", |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 70 | "helper/ccnx-app-helper.h", |
Alexander Afanasyev | f9f4eb0 | 2011-12-16 01:51:14 -0800 | [diff] [blame] | 71 | "helper/ccnx-header-helper.h", |
Alexander Afanasyev | c1e33eb | 2012-05-31 12:13:17 -0700 | [diff] [blame] | 72 | # "helper/ccnx-trace-helper.h", |
| 73 | # "helper/tracers/ipv4-app-tracer.h", |
| 74 | # "helper/tracers/ipv4-l3-tracer.h", |
| 75 | # "helper/tracers/ccnx-app-tracer.h", |
| 76 | # "helper/tracers/ccnx-l3-tracer.h", |
| 77 | # "helper/tracers/ccnx-consumer-window-tracer.h", |
| 78 | # "helper/tracers/ccnx-path-weight-tracer.h", |
Alexander Afanasyev | b3e4b85 | 2011-12-23 15:58:20 -0800 | [diff] [blame] | 79 | "helper/ccnx-face-container.h", |
Alexander Afanasyev | a5abcd9 | 2012-04-17 13:34:43 -0700 | [diff] [blame] | 80 | "helper/ccnx-global-routing-helper.h", |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 81 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 82 | "apps/ccnx-app.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 83 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 84 | "model/ccnx.h", |
Alexander Afanasyev | 7f3e49e | 2012-04-30 00:17:07 -0700 | [diff] [blame] | 85 | "model/ccnx-pit.h", |
| 86 | "model/ccnx-pit-entry.h", |
| 87 | "model/ccnx-pit-entry-incoming-face.h", |
| 88 | "model/ccnx-pit-entry-outgoing-face.h", |
Alexander Afanasyev | 161a5c4 | 2012-04-17 15:14:04 -0700 | [diff] [blame] | 89 | "model/ccnx-fib.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 90 | "model/ccnx-face.h", |
Alexander Afanasyev | 4a4ea60 | 2012-06-06 11:12:45 -0700 | [diff] [blame] | 91 | "model/ccnx-app-face.h", |
| 92 | "model/ccnx-net-device-face.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 93 | "model/ccnx-interest-header.h", |
| 94 | "model/ccnx-content-object-header.h", |
| 95 | "model/ccnx-name-components.h", |
Alexander Afanasyev | 161a5c4 | 2012-04-17 15:14:04 -0700 | [diff] [blame] | 96 | "model/ccnx-name-components-hash-helper.h", |
Alexander Afanasyev | 4975f73 | 2011-12-20 17:52:19 -0800 | [diff] [blame] | 97 | |
Alexander Afanasyev | 161a5c4 | 2012-04-17 15:14:04 -0700 | [diff] [blame] | 98 | "utils/batches.h", |
Alexander Afanasyev | c1e33eb | 2012-05-31 12:13:17 -0700 | [diff] [blame] | 99 | # "utils/weights-path-stretch-tag.h", |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 100 | ] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 101 | |
Alexander Afanasyev | ac46d45 | 2012-05-31 15:33:21 -0700 | [diff] [blame] | 102 | if 'topology' in bld.env['NDN_plugins']: |
| 103 | headers.source.extend ([ |
| 104 | "plugins/topology/rocketfuel-weights-reader.h", |
| 105 | "plugins/topology/annotated-topology-reader.h", |
| 106 | ]) |
| 107 | module.source.extend (bld.path.ant_glob(['plugins/topology/*.cc'])) |
| 108 | |
| 109 | if 'mobility' in bld.env['NDN_plugins']: |
| 110 | headers.source.extend ([ |
| 111 | "plugins/mobility/spring-mobility-model.h", |
| 112 | "plugins/mobility/spring-mobility-helper.h", |
| 113 | ]) |
| 114 | module.source.extend (bld.path.ant_glob(['plugins/mobility/*.cc'])) |
| 115 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 116 | tests.source = bld.path.ant_glob('test/*.cc'); |
| 117 | |
Alexander Afanasyev | f04d451 | 2012-02-14 18:42:47 -0800 | [diff] [blame] | 118 | if bld.env.ENABLE_EXAMPLES: |
| 119 | bld.add_subdirs('examples') |
Lucas | 64b8536 | 2012-01-30 16:28:37 -0800 | [diff] [blame] | 120 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame] | 121 | bld.ns3_python_bindings() |