blob: 2fb7153203da2ed3f9c3039c676ee22fe1484ace [file] [log] [blame]
Ilya Moiseenko1762af72011-07-18 16:43:10 -07001## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07003import os
4import Logs
5import Utils
Alexander Afanasyev2a5df202011-08-15 22:39:05 -07006import Options
7
Alexander Afanasyev9de011f2011-11-11 00:55:05 -08008from waflib.Errors import WafError
9
Alexander Afanasyev3b936292011-09-20 08:45:36 -070010def options(opt):
11 opt.tool_options('boost', tooldir=["waf-tools"])
Alexander Afanasyevac46d452012-05-31 15:33:21 -070012 opt.add_option('--enable-ndn-plugins',
13 help=("Enable NDN plugins (may require patching)"),
14 dest='enable_ndn_plugins')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070015
16def configure(conf):
Alexander Afanasyev3b936292011-09-20 08:45:36 -070017 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 Afanasyev2a5df202011-08-15 22:39:05 -070024 conf.report_optional_feature("ndn-abstract", "NDN abstraction", False,
25 "Required boost libraries not found")
26 conf.env['ENABLE_NDN_ABSTRACT']=False;
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070027 conf.env['MODULES_NOT_BUILT'].append('ndnSIM')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070028 return
Alexander Afanasyevac46d452012-05-31 15:33:21 -070029
30 conf.env['NDN_plugins'] = []
31 if Options.options.enable_ndn_plugins:
32 conf.env['NDN_plugins'] = Options.options.enable_ndn_plugins.split(',')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070033
34 conf.env['ENABLE_NDN_ABSTRACT']=True;
35
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070036
Ilya Moiseenko1762af72011-07-18 16:43:10 -070037def build(bld):
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070038 deps = ['core', 'network', 'point-to-point']
39 deps.append ('internet') # Until RttEstimator is moved to network module
Alexander Afanasyev3bea3702011-11-16 10:27:18 -080040 if bld.env['ENABLE_PYTHON_BINDINGS']:
41 deps.append ('visualizer')
42
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070043 if 'topology' in bld.env['NDN_plugins']:
44 deps.append ('topology-read')
45
Alexander Afanasyev4a3b2be2012-06-29 14:29:13 -070046 if 'mobility' in bld.env['NDN_plugins']:
47 deps.append ('mobility')
48
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070049 module = bld.create_ns3_module ('ndnSIM', deps)
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070050 module.uselib = 'BOOST BOOST_IOSTREAMS'
Alexander Afanasyev404c0792011-08-09 17:09:59 -070051
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070052 tests = bld.create_ns3_module_test_library('ndnSIM')
Alexander Afanasyev3b936292011-09-20 08:45:36 -070053 headers = bld.new_task_gen(features=['ns3header'])
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070054 headers.module = 'ndnSIM'
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070055
56 if not bld.env['ENABLE_NDN_ABSTRACT']:
Alexander Afanasyev57bcbc32012-06-01 01:46:24 -070057 bld.env['MODULES_NOT_BUILT'].append('ndnSIM')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070058 return
59
Alexander Afanasyev3b936292011-09-20 08:45:36 -070060 module.source = bld.path.ant_glob(['model/*.cc', 'apps/*.cc',
Alexander Afanasyev07827182011-12-13 01:07:32 -080061 'utils/*.cc',
62 'helper/*.cc',
Alexander Afanasyevb3e4b852011-12-23 15:58:20 -080063 'helper/tracers/*.cc',
Alexander Afanasyev07827182011-12-13 01:07:32 -080064 'helper/ccnb-parser/*.cc',
65 'helper/ccnb-parser/visitors/*.cc',
66 'helper/ccnb-parser/syntax-tree/*.cc'])
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070067
Alexander Afanasyev07827182011-12-13 01:07:32 -080068 headers.source = [
69 "helper/ccnx-stack-helper.h",
Alexander Afanasyev4975f732011-12-20 17:52:19 -080070 "helper/ccnx-app-helper.h",
Alexander Afanasyevf9f4eb02011-12-16 01:51:14 -080071 "helper/ccnx-header-helper.h",
Alexander Afanasyevc1e33eb2012-05-31 12:13:17 -070072 # "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 Afanasyevb3e4b852011-12-23 15:58:20 -080079 "helper/ccnx-face-container.h",
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -070080 "helper/ccnx-global-routing-helper.h",
Ilya Moiseenko1762af72011-07-18 16:43:10 -070081
Alexander Afanasyev07827182011-12-13 01:07:32 -080082 "apps/ccnx-app.h",
Alexander Afanasyev07827182011-12-13 01:07:32 -080083
Alexander Afanasyev07827182011-12-13 01:07:32 -080084 "model/ccnx.h",
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -070085 "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 Afanasyev9a989702012-06-29 17:44:00 -070089 "model/ccnx-content-store.h",
Alexander Afanasyev161a5c42012-04-17 15:14:04 -070090 "model/ccnx-fib.h",
Alexander Afanasyev78057c32012-07-06 15:18:46 -070091 "model/ccnx-fib-entry.h",
Alexander Afanasyev07827182011-12-13 01:07:32 -080092 "model/ccnx-face.h",
Alexander Afanasyev4a4ea602012-06-06 11:12:45 -070093 "model/ccnx-app-face.h",
94 "model/ccnx-net-device-face.h",
Alexander Afanasyev07827182011-12-13 01:07:32 -080095 "model/ccnx-interest-header.h",
96 "model/ccnx-content-object-header.h",
97 "model/ccnx-name-components.h",
Alexander Afanasyev161a5c42012-04-17 15:14:04 -070098 "model/ccnx-name-components-hash-helper.h",
Alexander Afanasyev4975f732011-12-20 17:52:19 -080099
Alexander Afanasyev161a5c42012-04-17 15:14:04 -0700100 "utils/batches.h",
Alexander Afanasyevc1e33eb2012-05-31 12:13:17 -0700101 # "utils/weights-path-stretch-tag.h",
Alexander Afanasyev07827182011-12-13 01:07:32 -0800102 ]
Alexander Afanasyev3b936292011-09-20 08:45:36 -0700103
Alexander Afanasyevac46d452012-05-31 15:33:21 -0700104 if 'topology' in bld.env['NDN_plugins']:
105 headers.source.extend ([
106 "plugins/topology/rocketfuel-weights-reader.h",
107 "plugins/topology/annotated-topology-reader.h",
108 ])
109 module.source.extend (bld.path.ant_glob(['plugins/topology/*.cc']))
110
111 if 'mobility' in bld.env['NDN_plugins']:
112 headers.source.extend ([
113 "plugins/mobility/spring-mobility-model.h",
114 "plugins/mobility/spring-mobility-helper.h",
115 ])
116 module.source.extend (bld.path.ant_glob(['plugins/mobility/*.cc']))
117
Alexander Afanasyev3b936292011-09-20 08:45:36 -0700118 tests.source = bld.path.ant_glob('test/*.cc');
119
Alexander Afanasyevf04d4512012-02-14 18:42:47 -0800120 if bld.env.ENABLE_EXAMPLES:
121 bld.add_subdirs('examples')
Lucas64b85362012-01-30 16:28:37 -0800122
Alexander Afanasyev07827182011-12-13 01:07:32 -0800123 bld.ns3_python_bindings()