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 | |
| 8 | def set_options(opt): |
| 9 | opt.tool_options('boost') |
| 10 | |
| 11 | def configure(conf): |
| 12 | conf.check_tool('boost') |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 13 | conf.env['BOOST'] = conf.check_boost(lib = 'iostreams', |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 14 | min_version='1.40.0' ) |
| 15 | if not conf.env['BOOST']: |
| 16 | conf.report_optional_feature("ndn-abstract", "NDN abstraction", False, |
| 17 | "Required boost libraries not found") |
| 18 | conf.env['ENABLE_NDN_ABSTRACT']=False; |
| 19 | return |
| 20 | |
| 21 | conf.env['ENABLE_NDN_ABSTRACT']=True; |
| 22 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 23 | |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 24 | def build(bld): |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 25 | module = bld.create_ns3_module ('NDNabstraction', ['core', 'network', 'point-to-point', |
Ilya Moiseenko | 3cc8efe | 2011-08-22 18:54:37 -0700 | [diff] [blame^] | 26 | 'topology-read','internet','applications']) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 27 | module.uselib = 'BOOST BOOST_IOSTREAMS' |
Alexander Afanasyev | 404c079 | 2011-08-09 17:09:59 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 29 | tests = bld.create_ns3_module_test_library('NDNabstraction') |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 30 | headers = bld.new_task_gen('ns3header') |
| 31 | headers.module = 'NDNabstraction' |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 32 | |
| 33 | if not bld.env['ENABLE_NDN_ABSTRACT']: |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 34 | conf.env['MODULES_NOT_BUILT'].append('NDNabstraction') |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 35 | return |
| 36 | |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 37 | module.find_sources_in_dirs (['model', 'apps', 'helper', |
| 38 | 'helper/ccnb-parser', |
| 39 | 'helper/ccnb-parser/visitors', |
| 40 | 'helper/ccnb-parser/syntax-tree'],[],['.cc']); |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 41 | tests.find_sources_in_dirs( ['test'], [], ['.cc'] ); |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 42 | headers.find_sources_in_dirs( ['model', 'apps', 'helper', |
| 43 | 'helper/ccnb-parser', |
| 44 | 'helper/ccnb-parser/visitors', |
| 45 | 'helper/ccnb-parser/syntax-tree'], [], ['.h'] ); |
Alexander Afanasyev | 2a5df20 | 2011-08-15 22:39:05 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 47 | if True or bld.env['ENABLE_EXAMPLES']: |
| 48 | for path in ["examples"]: |
| 49 | anode = bld.path.find_dir (path) |
| 50 | if not anode or not anode.is_child_of(bld.srcnode): |
| 51 | raise Utils.WscriptError("Unable to use '%s' - either because \ |
| 52 | it's not a relative path"", or it's not child of \ |
Alexander Afanasyev | 8b37905 | 2011-08-21 16:58:20 -0700 | [diff] [blame] | 53 | '%s'."%(name,bld.srcnode)) |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 54 | bld.rescan(anode) |
| 55 | for filename in bld.cache_dir_contents[anode.id]: |
| 56 | if filename.startswith('.') or not filename.endswith(".cc"): |
| 57 | continue |
| 58 | name = filename[:-len(".cc")] |
| 59 | obj = bld.create_ns3_program(name, ['NDNabstraction']) |
| 60 | obj.path = obj.path.find_dir (path) |
| 61 | obj.source = filename |
| 62 | obj.target = name |
| 63 | obj.name = obj.target |
| 64 | obj.uselib = 'BOOST BOOST_IOSTREAMS' |
Ilya Moiseenko | 1762af7 | 2011-07-18 16:43:10 -0700 | [diff] [blame] | 65 | |
Ilya Moiseenko | 02fb706 | 2011-08-11 17:18:00 -0700 | [diff] [blame] | 66 | bld.ns3_python_bindings() |
Alexander Afanasyev | 43e7025 | 2011-08-08 18:48:18 -0700 | [diff] [blame] | 67 | |