blob: bd94d0fd66c61e65df06c1b05c72f517c823ff1a [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 Afanasyev3b936292011-09-20 08:45:36 -07008def options(opt):
9 opt.tool_options('boost', tooldir=["waf-tools"])
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070010
11def configure(conf):
Alexander Afanasyev3b936292011-09-20 08:45:36 -070012 try:
13 conf.check_tool('boost')
14 conf.check_boost(lib = 'iostreams')
15 except WafError:
16 conf.env['LIB_BOOST'] = []
17
18 if not conf.env['LIB_BOOST']:
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070019 conf.report_optional_feature("ndn-abstract", "NDN abstraction", False,
20 "Required boost libraries not found")
21 conf.env['ENABLE_NDN_ABSTRACT']=False;
Alexander Afanasyev3b936292011-09-20 08:45:36 -070022 conf.env['MODULES_NOT_BUILT'].append('NDNabstraction')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070023 return
24
25 conf.env['ENABLE_NDN_ABSTRACT']=True;
26
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070027
Ilya Moiseenko1762af72011-07-18 16:43:10 -070028def build(bld):
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070029 module = bld.create_ns3_module ('NDNabstraction', ['core', 'network', 'point-to-point',
Ilya Moiseenko3cc8efe2011-08-22 18:54:37 -070030 'topology-read','internet','applications'])
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070031 module.uselib = 'BOOST BOOST_IOSTREAMS'
Alexander Afanasyev404c0792011-08-09 17:09:59 -070032
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070033 tests = bld.create_ns3_module_test_library('NDNabstraction')
Alexander Afanasyev3b936292011-09-20 08:45:36 -070034 headers = bld.new_task_gen(features=['ns3header'])
Ilya Moiseenko1762af72011-07-18 16:43:10 -070035 headers.module = 'NDNabstraction'
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070036
37 if not bld.env['ENABLE_NDN_ABSTRACT']:
Alexander Afanasyev3b936292011-09-20 08:45:36 -070038 bld.env['MODULES_NOT_BUILT'].append('NDNabstraction')
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070039 return
40
Alexander Afanasyev3b936292011-09-20 08:45:36 -070041 module.source = bld.path.ant_glob(['model/*.cc', 'apps/*.cc',
42 'helper/*.cc',
43 'helper/ccnb-parser/*.cc',
44 'helper/ccnb-parser/visitors/*.cc',
45 'helper/ccnb-parser/syntax-tree/*.cc'])
Alexander Afanasyev2a5df202011-08-15 22:39:05 -070046
Alexander Afanasyev3b936292011-09-20 08:45:36 -070047 headers.source = bld.path.ant_glob(['model/*.h', 'apps/*.h',
48 'helper/*.h',
49 'helper/ccnb-parser/*.h',
50 'helper/ccnb-parser/visitors/*.h',
51 'helper/ccnb-parser/syntax-tree/*.h'])
Ilya Moiseenko1762af72011-07-18 16:43:10 -070052
Alexander Afanasyev3b936292011-09-20 08:45:36 -070053 headers.source = [x.path_from(bld.path) for x in headers.source]
54
55 tests.source = bld.path.ant_glob('test/*.cc');
56
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070057 if True or bld.env['ENABLE_EXAMPLES']:
Alexander Afanasyev5b433862011-10-31 15:25:07 -070058 obj = bld.create_ns3_program('ccnx-test', ['NDNabstraction', 'internet'])
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070059 obj.source = 'examples/ccnx-test.cc'
Alexander Afanasyev5b433862011-10-31 15:25:07 -070060
61 obj = bld.create_ns3_program('ccnx-routing-simple', ['NDNabstraction', 'point-to-point-layout'])
62 obj.source = 'examples/ccnx-routing-simple.cc'
63
Ilya Moiseenkoc9266042011-11-02 17:49:21 -070064 obj = bld.create_ns3_program('ccnx-grid', ['NDNabstraction', 'point-to-point-layout'])
65 obj.source = 'examples/ccnx-grid.cc'
Alexander Afanasyev4ac503d2011-10-28 15:45:39 -070066
Alexander Afanasyev3b936292011-09-20 08:45:36 -070067 # for path in ["examples"]:
68 # anode = bld.path.find_dir (path)
69 # if not anode or not anode.is_child_of(bld.srcnode):
70 # raise Utils.WscriptError("Unable to use '%s' - either because \
71 # it's not a relative path"", or it's not child of \
72 # '%s'."%(name,bld.srcnode))
73 # bld.rescan(anode)
74 # for filename in bld.cache_dir_contents[anode.id]:
75 # if filename.startswith('.') or not filename.endswith(".cc"):
76 # continue
77 # name = filename[:-len(".cc")]
78 # obj = bld.create_ns3_program(name, ['NDNabstraction'])
79 # obj.path = obj.path.find_dir (path)
80 # obj.source = filename
81 # obj.target = name
82 # obj.name = obj.target
83 # obj.uselib = 'BOOST BOOST_IOSTREAMS'
84
85 # bld.ns3_python_bindings()