blob: a16b8574a384f4c6e27f10f1228d85f0a0daf6e5 [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 Afanasyev2a5df202011-08-15 22:39:05 -070012
13def configure(conf):
Alexander Afanasyev3b936292011-09-20 08:45:36 -070014 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 Afanasyev2a5df202011-08-15 22:39:05 -070021 conf.report_optional_feature("ndn-abstract", "NDN abstraction", False,
22 "Required boost libraries not found")
23 conf.env['ENABLE_NDN_ABSTRACT']=False;
Alexander Afanasyev3b936292011-09-20 08:45:36 -070024 conf.env['MODULES_NOT_BUILT'].append('NDNabstraction')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070025 return
26
27 conf.env['ENABLE_NDN_ABSTRACT']=True;
28
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070029
Ilya Moiseenko1762af72011-07-18 16:43:10 -070030def build(bld):
Alexander Afanasyev3bea3702011-11-16 10:27:18 -080031 deps = ['core', 'network', 'point-to-point',
32 'topology-read','internet','applications',
33 'point-to-point-layout']
34 if bld.env['ENABLE_PYTHON_BINDINGS']:
35 deps.append ('visualizer')
36
37 module = bld.create_ns3_module ('NDNabstraction', deps)
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070038 module.uselib = 'BOOST BOOST_IOSTREAMS'
Alexander Afanasyev404c0792011-08-09 17:09:59 -070039
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070040 tests = bld.create_ns3_module_test_library('NDNabstraction')
Alexander Afanasyev3b936292011-09-20 08:45:36 -070041 headers = bld.new_task_gen(features=['ns3header'])
Ilya Moiseenko1762af72011-07-18 16:43:10 -070042 headers.module = 'NDNabstraction'
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070043
44 if not bld.env['ENABLE_NDN_ABSTRACT']:
Alexander Afanasyev3b936292011-09-20 08:45:36 -070045 bld.env['MODULES_NOT_BUILT'].append('NDNabstraction')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070046 return
47
Alexander Afanasyev3b936292011-09-20 08:45:36 -070048 module.source = bld.path.ant_glob(['model/*.cc', 'apps/*.cc',
49 'helper/*.cc',
50 'helper/ccnb-parser/*.cc',
51 'helper/ccnb-parser/visitors/*.cc',
52 'helper/ccnb-parser/syntax-tree/*.cc'])
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070053
Alexander Afanasyev3b936292011-09-20 08:45:36 -070054 headers.source = bld.path.ant_glob(['model/*.h', 'apps/*.h',
55 'helper/*.h',
56 'helper/ccnb-parser/*.h',
57 'helper/ccnb-parser/visitors/*.h',
58 'helper/ccnb-parser/syntax-tree/*.h'])
Ilya Moiseenko1762af72011-07-18 16:43:10 -070059
Alexander Afanasyev3b936292011-09-20 08:45:36 -070060 headers.source = [x.path_from(bld.path) for x in headers.source]
61
62 tests.source = bld.path.ant_glob('test/*.cc');
63
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070064 if True or bld.env['ENABLE_EXAMPLES']:
Alexander Afanasyev5b433862011-10-31 15:25:07 -070065 obj = bld.create_ns3_program('ccnx-test', ['NDNabstraction', 'internet'])
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070066 obj.source = 'examples/ccnx-test.cc'
Alexander Afanasyev5b433862011-10-31 15:25:07 -070067
68 obj = bld.create_ns3_program('ccnx-routing-simple', ['NDNabstraction', 'point-to-point-layout'])
69 obj.source = 'examples/ccnx-routing-simple.cc'
70
Ilya Moiseenkoc9266042011-11-02 17:49:21 -070071 obj = bld.create_ns3_program('ccnx-grid', ['NDNabstraction', 'point-to-point-layout'])
72 obj.source = 'examples/ccnx-grid.cc'
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070073
Ilya Moiseenko00b30482011-11-15 17:58:00 -080074 obj = bld.create_ns3_program('syntactic-topology', ['NDNabstraction', 'point-to-point-layout'])
75 obj.source = 'examples/syntactic-topology-ndnabstraction.cc'
76
77 obj = bld.create_ns3_program('annotated-topology', ['NDNabstraction', 'point-to-point-layout'])
78 obj.source = 'examples/annotated-topology-read-example.cc'
79
Alexander Afanasyev3b936292011-09-20 08:45:36 -070080 # for path in ["examples"]:
81 # anode = bld.path.find_dir (path)
82 # if not anode or not anode.is_child_of(bld.srcnode):
83 # raise Utils.WscriptError("Unable to use '%s' - either because \
84 # it's not a relative path"", or it's not child of \
85 # '%s'."%(name,bld.srcnode))
86 # bld.rescan(anode)
87 # for filename in bld.cache_dir_contents[anode.id]:
88 # if filename.startswith('.') or not filename.endswith(".cc"):
89 # continue
90 # name = filename[:-len(".cc")]
91 # obj = bld.create_ns3_program(name, ['NDNabstraction'])
92 # obj.path = obj.path.find_dir (path)
93 # obj.source = filename
94 # obj.target = name
95 # obj.name = obj.target
96 # obj.uselib = 'BOOST BOOST_IOSTREAMS'
97
98 # bld.ns3_python_bindings()