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 | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 12 | |
| 13 | def configure(conf): |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 14 | try: |
| 15 | conf.check_tool('boost') |
| 16 | conf.check_boost(lib = 'iostreams') |
| 17 | except WafError: |
| 18 | conf.env['LIB_BOOST'] = [] |
| 19 | |
| 20 | if not conf.env['LIB_BOOST']: |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 21 | conf.report_optional_feature("ndn-abstract", "NDN abstraction", False, |
| 22 | "Required boost libraries not found") |
| 23 | conf.env['ENABLE_NDN_ABSTRACT']=False; |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 24 | conf.env['MODULES_NOT_BUILT'].append('NDNabstraction') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 25 | return |
| 26 | |
| 27 | conf.env['ENABLE_NDN_ABSTRACT']=True; |
| 28 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 29 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 30 | def build(bld): |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 31 | deps = ['core', 'network', 'point-to-point', |
| 32 | 'topology-read','internet','applications', |
Alexander Afanasyev | 9d313d4 | 2011-11-25 13:36:15 -0800 | [diff] [blame] | 33 | 'point-to-point-layout', 'netanim'] |
Alexander Afanasyev | 3bea370 | 2011-11-16 10:27:18 -0800 | [diff] [blame] | 34 | if bld.env['ENABLE_PYTHON_BINDINGS']: |
| 35 | deps.append ('visualizer') |
| 36 | |
| 37 | module = bld.create_ns3_module ('NDNabstraction', deps) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 38 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 39 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 40 | tests = bld.create_ns3_module_test_library('NDNabstraction') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 41 | headers = bld.new_task_gen(features=['ns3header']) |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 42 | headers.module = 'NDNabstraction' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 43 | |
| 44 | if not bld.env['ENABLE_NDN_ABSTRACT']: |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 45 | bld.env['MODULES_NOT_BUILT'].append('NDNabstraction') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 46 | return |
| 47 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 48 | module.source = bld.path.ant_glob(['model/*.cc', 'apps/*.cc', |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame^] | 49 | 'utils/*.cc', |
| 50 | 'helper/*.cc', |
| 51 | 'helper/ccnb-parser/*.cc', |
| 52 | 'helper/ccnb-parser/visitors/*.cc', |
| 53 | 'helper/ccnb-parser/syntax-tree/*.cc']) |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 54 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame^] | 55 | headers.source = [ |
| 56 | "helper/ccnx-stack-helper.h", |
| 57 | "helper/ccnx-producer-helper.h", |
| 58 | "helper/ccnx-consumer-helper.h", |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 59 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame^] | 60 | "apps/ccnx-app.h", |
| 61 | "apps/ccnx-consumer.h", |
| 62 | "apps/ccnx-producer.h", |
| 63 | |
| 64 | "model/hash-helper.h", |
| 65 | "model/ccnx.h", |
| 66 | "model/ccnx-face.h", |
| 67 | |
| 68 | "model/ccnx-interest-header.h", |
| 69 | "model/ccnx-content-object-header.h", |
| 70 | "model/ccnx-name-components.h", |
| 71 | "model/ccnx-fib.h", |
| 72 | |
| 73 | "helper/ccnx-face-container.h", |
| 74 | "model/rocketfuel-weights-reader.h", |
| 75 | "model/annotated-topology-reader.h", |
| 76 | ] |
| 77 | # headers.source = bld.path.ant_glob(['model/*.h', 'apps/*.h', |
| 78 | # 'helper/*.h', |
| 79 | # 'helper/ccnb-parser/*.h', |
| 80 | # 'helper/ccnb-parser/visitors/*.h', |
| 81 | # 'helper/ccnb-parser/syntax-tree/*.h']) |
| 82 | |
| 83 | # headers.source = [x.path_from(bld.path) for x in headers.source] |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 84 | |
| 85 | tests.source = bld.path.ant_glob('test/*.cc'); |
| 86 | |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 87 | if True or bld.env['ENABLE_EXAMPLES']: |
Alexander Afanasyev | 5b43386 | 2011-10-31 15:25:07 -0700 | [diff] [blame] | 88 | obj = bld.create_ns3_program('ccnx-test', ['NDNabstraction', 'internet']) |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 89 | obj.source = 'examples/ccnx-test.cc' |
Alexander Afanasyev | 5b43386 | 2011-10-31 15:25:07 -0700 | [diff] [blame] | 90 | |
| 91 | obj = bld.create_ns3_program('ccnx-routing-simple', ['NDNabstraction', 'point-to-point-layout']) |
| 92 | obj.source = 'examples/ccnx-routing-simple.cc' |
| 93 | |
Ilya Moiseenko | c926604 | 2011-11-02 17:49:21 -0700 | [diff] [blame] | 94 | obj = bld.create_ns3_program('ccnx-grid', ['NDNabstraction', 'point-to-point-layout']) |
| 95 | obj.source = 'examples/ccnx-grid.cc' |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 96 | |
Ilya Moiseenko | 00b3048 | 2011-11-15 17:58:00 -0800 | [diff] [blame] | 97 | obj = bld.create_ns3_program('syntactic-topology', ['NDNabstraction', 'point-to-point-layout']) |
| 98 | obj.source = 'examples/syntactic-topology-ndnabstraction.cc' |
| 99 | |
| 100 | obj = bld.create_ns3_program('annotated-topology', ['NDNabstraction', 'point-to-point-layout']) |
| 101 | obj.source = 'examples/annotated-topology-read-example.cc' |
| 102 | |
Alexander Afanasyev | 233f197 | 2011-11-21 11:27:18 -0800 | [diff] [blame] | 103 | obj = bld.create_ns3_program('interest-header-example', ['NDNabstraction']) |
| 104 | obj.source = 'examples/interest-header-example.cc' |
| 105 | |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 106 | obj = bld.create_ns3_program('packet-sizes', ['NDNabstraction']) |
| 107 | obj.source = 'examples/packet-sizes.cc' |
Alexander Afanasyev | 09374c0 | 2011-12-08 13:54:56 -0800 | [diff] [blame] | 108 | |
| 109 | obj = bld.create_ns3_program('ccnx-sprint-topology', ['NDNabstraction']) |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 110 | obj.source = 'examples/sprint-topology.cc' |
| 111 | |
Alexander Afanasyev | 09374c0 | 2011-12-08 13:54:56 -0800 | [diff] [blame] | 112 | obj = bld.create_ns3_program('ccnx-abilene-topology', ['NDNabstraction']) |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 113 | obj.source = 'examples/abilene-topology.cc' |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 114 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 115 | # for path in ["examples"]: |
| 116 | # anode = bld.path.find_dir (path) |
| 117 | # if not anode or not anode.is_child_of(bld.srcnode): |
| 118 | # raise Utils.WscriptError("Unable to use '%s' - either because \ |
| 119 | # it's not a relative path"", or it's not child of \ |
| 120 | # '%s'."%(name,bld.srcnode)) |
| 121 | # bld.rescan(anode) |
| 122 | # for filename in bld.cache_dir_contents[anode.id]: |
| 123 | # if filename.startswith('.') or not filename.endswith(".cc"): |
| 124 | # continue |
| 125 | # name = filename[:-len(".cc")] |
| 126 | # obj = bld.create_ns3_program(name, ['NDNabstraction']) |
| 127 | # obj.path = obj.path.find_dir (path) |
| 128 | # obj.source = filename |
| 129 | # obj.target = name |
| 130 | # obj.name = obj.target |
| 131 | # obj.uselib = 'BOOST BOOST_IOSTREAMS' |
| 132 | |
Alexander Afanasyev | 0782718 | 2011-12-13 01:07:32 -0800 | [diff] [blame^] | 133 | bld.ns3_python_bindings() |