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 | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 8 | def options(opt): |
| 9 | opt.tool_options('boost', tooldir=["waf-tools"]) |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 10 | |
| 11 | def configure(conf): |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 12 | 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 Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 19 | conf.report_optional_feature("ndn-abstract", "NDN abstraction", False, |
| 20 | "Required boost libraries not found") |
| 21 | conf.env['ENABLE_NDN_ABSTRACT']=False; |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 22 | conf.env['MODULES_NOT_BUILT'].append('NDNabstraction') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 23 | return |
| 24 | |
| 25 | conf.env['ENABLE_NDN_ABSTRACT']=True; |
| 26 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 27 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 28 | def build(bld): |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 29 | module = bld.create_ns3_module ('NDNabstraction', ['core', 'network', 'point-to-point', |
Ilya Moiseenko | 3cc8efe | 2011-08-22 18:54:37 -0700 | [diff] [blame] | 30 | 'topology-read','internet','applications']) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 31 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 32 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 33 | tests = bld.create_ns3_module_test_library('NDNabstraction') |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 34 | headers = bld.new_task_gen(features=['ns3header']) |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 35 | headers.module = 'NDNabstraction' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 36 | |
| 37 | if not bld.env['ENABLE_NDN_ABSTRACT']: |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 38 | bld.env['MODULES_NOT_BUILT'].append('NDNabstraction') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 39 | return |
| 40 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 41 | 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 Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 47 | 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 Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 52 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 53 | headers.source = [x.path_from(bld.path) for x in headers.source] |
| 54 | |
| 55 | tests.source = bld.path.ant_glob('test/*.cc'); |
| 56 | |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 57 | if True or bld.env['ENABLE_EXAMPLES']: |
Alexander Afanasyev | 5b43386 | 2011-10-31 15:25:07 -0700 | [diff] [blame^] | 58 | obj = bld.create_ns3_program('ccnx-test', ['NDNabstraction', 'internet']) |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 59 | obj.source = 'examples/ccnx-test.cc' |
Alexander Afanasyev | 5b43386 | 2011-10-31 15:25:07 -0700 | [diff] [blame^] | 60 | |
| 61 | obj = bld.create_ns3_program('ccnx-routing-simple', ['NDNabstraction', 'point-to-point-layout']) |
| 62 | obj.source = 'examples/ccnx-routing-simple.cc' |
| 63 | |
Alexander Afanasyev | 4ac503d | 2011-10-28 15:45:39 -0700 | [diff] [blame] | 64 | |
Alexander Afanasyev | 3b93629 | 2011-09-20 08:45:36 -0700 | [diff] [blame] | 65 | # for path in ["examples"]: |
| 66 | # anode = bld.path.find_dir (path) |
| 67 | # if not anode or not anode.is_child_of(bld.srcnode): |
| 68 | # raise Utils.WscriptError("Unable to use '%s' - either because \ |
| 69 | # it's not a relative path"", or it's not child of \ |
| 70 | # '%s'."%(name,bld.srcnode)) |
| 71 | # bld.rescan(anode) |
| 72 | # for filename in bld.cache_dir_contents[anode.id]: |
| 73 | # if filename.startswith('.') or not filename.endswith(".cc"): |
| 74 | # continue |
| 75 | # name = filename[:-len(".cc")] |
| 76 | # obj = bld.create_ns3_program(name, ['NDNabstraction']) |
| 77 | # obj.path = obj.path.find_dir (path) |
| 78 | # obj.source = filename |
| 79 | # obj.target = name |
| 80 | # obj.name = obj.target |
| 81 | # obj.uselib = 'BOOST BOOST_IOSTREAMS' |
| 82 | |
| 83 | # bld.ns3_python_bindings() |