LEFT | RIGHT |
(no file at all) | |
| 1 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8;
-*- |
| 2 |
| 3 import os |
| 4 |
| 5 from waflib import Options |
| 6 |
| 7 def options(opt): |
| 8 opt.add_option('--with-woss-source', |
| 9 help=('Path to WOSS source code, for WOSS Integration Framewo
rk support'), |
| 10 dest='with_woss_source', default=None) |
| 11 opt.add_option('--with-woss-library', |
| 12 help=('Path to WOSS library, for NS-3 WOSS Integration Framew
ork support'), |
| 13 dest='with_woss_lib', default=None) |
| 14 opt.add_option('--with-netcdf-include', |
| 15 help=('Path to NetCDF library include code, for WOSS Integrat
ion Framework support'), |
| 16 dest='with_netcdf_src', default=None) |
| 17 opt.add_option('--with-netcdf-library', |
| 18 help=('Path to NetCDF library, for WOSS Integration Framework
support'), |
| 19 dest='with_netcdf_lib', default=None) |
| 20 |
| 21 def configure(conf): |
| 22 |
| 23 config_error = "false" |
| 24 |
| 25 if Options.options.with_woss_source: |
| 26 conf.msg("Checking the given WOSS source code path", ("%s (given)" % Opt
ions.options.with_woss_source)) |
| 27 if os.path.isdir(Options.options.with_woss_source): |
| 28 conf.env['WITH_WOSS_SOURCE'] = os.path.abspath(Options.options.with_
woss_source) |
| 29 else: |
| 30 conf.msg("WOSS source code path", False) |
| 31 config_error = "true" |
| 32 else: |
| 33 conf.report_optional_feature("WOSS", "WOSS Integration Framework", False
, |
| 34 "WOSS not enabled (see option --with-woss)"
) |
| 35 # Add this module to the list of modules that won't be built |
| 36 # if they are enabled. |
| 37 conf.env['MODULES_NOT_BUILT'].append('woss') |
| 38 return |
| 39 |
| 40 if Options.options.with_woss_lib: |
| 41 conf.msg("Checking the given WOSS library path", ("%s (given)" % Options
.options.with_woss_lib)) |
| 42 if os.path.isdir(Options.options.with_woss_lib): |
| 43 conf.env['WITH_WOSS_LIB'] = os.path.abspath(Options.options.with_wos
s_lib) |
| 44 else: |
| 45 conf.msg("WOSS library path", False) |
| 46 config_error = "true" |
| 47 else: |
| 48 conf.msg("Checking for WOSS library location", ("%s (guessed)" % '/usr/l
ib')) |
| 49 conf.env['WITH_WOSS_LIB'] = os.path.abspath('/usr/lib') |
| 50 |
| 51 if Options.options.with_netcdf_src: |
| 52 conf.msg("Checking the given NetCDF source code path", ("%s (given)" % O
ptions.options.with_netcdf_src)) |
| 53 if os.path.isdir(Options.options.with_netcdf_src): |
| 54 conf.env['WITH_NETCDF_SRC'] = os.path.abspath(Options.options.with_n
etcdf_src) |
| 55 else: |
| 56 conf.msg("NetCDF source code path", False) |
| 57 config_error = "true" |
| 58 |
| 59 if Options.options.with_netcdf_lib: |
| 60 conf.msg("Checking the given NetCDF library path", ("%s (given)" % Optio
ns.options.with_netcdf_lib)) |
| 61 if os.path.isdir(Options.options.with_netcdf_lib): |
| 62 conf.env['WITH_NETCDF_LIB'] = os.path.abspath(Options.options.with_n
etcdf_lib) |
| 63 else: |
| 64 conf.msg("NetCDF library path", False) |
| 65 config_error = "true" |
| 66 else: |
| 67 conf.msg("Checking the NetCDF library path", ("%s (guessed)" % '/usr/lib
')) |
| 68 conf.env['WITH_NETCDF_LIB'] = os.path.abspath('/usr/lib') |
| 69 |
| 70 if config_error == "true": |
| 71 conf.report_optional_feature("WOSS", "WOSS Integration Framework", False
, |
| 72 "WOSS configuration error") |
| 73 |
| 74 # Add this module to the list of modules that won't be built |
| 75 # if they are enabled. |
| 76 conf.env['MODULES_NOT_BUILT'].append('woss') |
| 77 return |
| 78 |
| 79 if conf.env['WITH_WOSS_SOURCE']: |
| 80 |
| 81 for tmp in ['woss', 'woss/woss_def', 'woss/woss_db']: |
| 82 inc_dir = os.path.abspath(os.path.join(conf.env['WITH_WOSS_SOURCE'],
tmp)) |
| 83 if os.path.isdir(inc_dir): |
| 84 conf.msg("WOSS source code path is valid", ("%s " % inc_dir)) |
| 85 conf.env.append_value('INCLUDES_WOSS', inc_dir) |
| 86 else: |
| 87 conf.msg("WOSS source code path is not valid", ("%s " % inc_dir)
) |
| 88 conf.report_optional_feature("WOSS", "WOSS Integration Framework
", False, |
| 89 "WOSS configuration error") |
| 90 |
| 91 # Add this module to the list of modules that won't be built |
| 92 # if they are enabled. |
| 93 conf.env['MODULES_NOT_BUILT'].append('woss') |
| 94 return |
| 95 |
| 96 conf.env['LIBPATH_WOSS']=conf.env['WITH_WOSS_LIB'] |
| 97 conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_WOSS']) |
| 98 conf.env['LIB_WOSS'] = ['WOSS'] |
| 99 conf.env['DEFINES_WOSS'] = ['WOSS_MULTITHREAD'] |
| 100 conf.env.append_value('DEFINES_WOSS', 'NS3_WOSS_SUPPORT') |
| 101 |
| 102 conf.env['WOSS'] = conf.check(mandatory=True, lib='WOSS', define_name='W
OSS', libpath=conf.env['WITH_WOSS_LIB'] , uselib_store='WOSS', |
| 103 msg="Checking the given WOSS libra
ry") |
| 104 |
| 105 if conf.env['WITH_NETCDF_SRC']: |
| 106 conf.msg("NetCDF source code path", ("%s " % conf.env['WITH_NETCDF_S
RC'])) |
| 107 · |
| 108 conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT'] |
| 109 conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF_SRC'] |
| 110 conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF_LIB'] |
| 111 conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF']) |
| 112 conf.env['LIB_NETCDF'] = ['netcdf_c++', 'netcdf'] |
| 113 |
| 114 conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++ netc
df', libpath=conf.env['WITH_NETCDF_LIB'], define_name='NETCDF_CPP', uselib_store
='NETCDF_CPP', msg="Checking the given NETCDF library") |
| 115 |
| 116 conf.report_optional_feature("WOSS", "WOSS Integration Framework", T
rue, |
| 117 "WOSS correctly configured") |
| 118 else: |
| 119 conf.msg("Checking for NetCDF source location", False) |
| 120 |
| 121 |
| 122 def build(bld): |
| 123 if 'woss' in bld.env['MODULES_NOT_BUILT']: |
| 124 return |
| 125 |
| 126 module = bld.create_ns3_module('woss', ['network', 'energy', 'mobility', 'ua
n']) |
| 127 module.source = [ |
| 128 'model/definitions/woss-location.cc', |
| 129 'model/definitions/woss-time-reference.cc', |
| 130 'model/definitions/woss-random-generator.cc', |
| 131 'model/woss-prop-model.cc', |
| 132 'model/woss-channel.cc', |
| 133 'model/woss-position-allocator.cc', |
| 134 'model/woss-waypoint-mobility-model.cc', |
| 135 'helper/woss-helper.cc', |
| 136 ] |
| 137 |
| 138 module_test = bld.create_ns3_module_test_library('woss') |
| 139 module_test.source = [ |
| 140 'test/woss-test.cc', |
| 141 ] |
| 142 headers = bld(features='ns3header') |
| 143 headers.module = 'woss' |
| 144 headers.source = [ |
| 145 'model/definitions/woss-location.h', |
| 146 'model/definitions/woss-time-reference.h', |
| 147 'model/definitions/woss-random-generator.h', |
| 148 'model/woss-prop-model.h', |
| 149 'model/woss-channel.h', |
| 150 'model/woss-position-allocator.h', |
| 151 'model/woss-waypoint-mobility-model.h', |
| 152 'helper/woss-helper.h', |
| 153 ] |
| 154 |
| 155 if bld.env['WOSS']: |
| 156 if bld.env['NETCDF']: |
| 157 module.use.extend(['WOSS', 'NETCDF']) |
| 158 module_test.use.extend(['WOSS', 'NETCDF']) |
| 159 else: |
| 160 module.use.extend(['WOSS']) |
| 161 module_test.use.extend(['WOSS']) |
| 162 |
| 163 if (bld.env['ENABLE_EXAMPLES']): |
| 164 bld.recurse('examples') |
| 165 |
LEFT | RIGHT |