forked from MetalKnight/woss-ns3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
178 lines (151 loc) · 8.53 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
import os
from waflib import Options
def options(opt):
opt.add_option('--with-woss-source',
help=('Path to WOSS source code, for WOSS Integration Framework support'),
dest='with_woss_source', default=None)
opt.add_option('--with-woss-library',
help=('Path to WOSS library, for NS-3 WOSS Integration Framework support'),
dest='with_woss_lib', default=None)
opt.add_option('--with-netcdf-install',
help=('Path to NetCDF legacy library install, for WOSS Integration Framework support'),
dest='with_netcdf_install', default=None)
opt.add_option('--with-netcdf4-install',
help=('Path to NetCDF4 and HDF5 library install, for WOSS Integration Framework support'),
dest='with_netcdf4_install', default=None)
def configure(conf):
config_error = "false"
if Options.options.with_woss_source:
conf.msg("Checking the given WOSS source code path", ("%s (given)" % Options.options.with_woss_source))
if os.path.isdir(Options.options.with_woss_source):
conf.env['WITH_WOSS_SOURCE'] = os.path.abspath(Options.options.with_woss_source)
else:
conf.msg("WOSS source code path", False)
config_error = "true"
else:
conf.report_optional_feature("WOSS", "WOSS Integration Framework", False,
"WOSS not enabled (see option --with-woss)")
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('woss-ns3')
return
if Options.options.with_woss_lib:
conf.msg("Checking the given WOSS library path", ("%s (given)" % Options.options.with_woss_lib))
if os.path.isdir(Options.options.with_woss_lib):
conf.env['WITH_WOSS_LIB'] = os.path.abspath(Options.options.with_woss_lib)
else:
conf.msg("WOSS library path", False)
config_error = "true"
else:
conf.msg("Checking for WOSS library location", ("%s (guessed)" % '/usr/lib'))
conf.env['WITH_WOSS_LIB'] = os.path.abspath('/usr/lib')
if Options.options.with_netcdf4_install:
conf.msg("Checking the given NetCDF4 and HDF5 install path", ("%s (given)" % Options.options.with_netcdf4_install))
if (os.path.isdir(Options.options.with_netcdf4_install) and
os.path.isdir(Options.options.with_netcdf4_install + '/include') and
os.path.isdir(Options.options.with_netcdf4_install + '/lib')):
conf.env['WITH_NETCDF4_SRC'] = os.path.abspath(Options.options.with_netcdf4_install + '/include')
conf.env['WITH_NETCDF4_LIB'] = os.path.abspath(Options.options.with_netcdf4_install + '/lib')
else:
conf.msg("NetCDF4 and HDF5 install path", False)
config_error = "true"
elif Options.options.with_netcdf_install:
conf.msg("Checking the given NetCDF legacy install path", ("%s (given)" % Options.options.with_netcdf_install))
if (os.path.isdir(Options.options.with_netcdf_install) and
os.path.isdir(Options.options.with_netcdf_install + '/include') and
os.path.isdir(Options.options.with_netcdf_install + '/lib')):
conf.env['WITH_NETCDF_SRC'] = os.path.abspath(Options.options.with_netcdf_install + '/include')
conf.env['WITH_NETCDF_LIB'] = os.path.abspath(Options.options.with_netcdf_install + '/lib')
else:
conf.msg("NetCDF legacy install path", False)
config_error = "true"
else:
conf.msg("NetCDF support", False)
if config_error == "true":
conf.report_optional_feature("WOSS", "WOSS Integration Framework", False,
"WOSS configuration error")
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('woss-ns3')
return
if conf.env['WITH_WOSS_SOURCE']:
for tmp in ['woss', 'woss/woss_def', 'woss/woss_db']:
inc_dir = os.path.abspath(os.path.join(conf.env['WITH_WOSS_SOURCE'],tmp))
if os.path.isdir(inc_dir):
conf.msg("WOSS source code path is valid", ("%s " % inc_dir))
conf.env.append_value('INCLUDES_WOSS', inc_dir)
else:
conf.msg("WOSS source code path is not valid", ("%s " % inc_dir))
conf.report_optional_feature("WOSS", "WOSS Integration Framework", False,
"WOSS configuration error")
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('woss-ns3')
return
conf.env['LIBPATH_WOSS']=conf.env['WITH_WOSS_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_WOSS'])
conf.env['LIB_WOSS'] = ['WOSS']
conf.env['DEFINES_WOSS'] = ['WOSS_MULTITHREAD']
conf.env.append_value('DEFINES_WOSS', 'NS3_WOSS_SUPPORT')
conf.env['WOSS'] = conf.check(mandatory=True, lib='WOSS', define_name='WOSS', libpath=conf.env['WITH_WOSS_LIB'] , uselib_store='WOSS',
msg="Checking the given WOSS library")
if conf.env['WITH_NETCDF_SRC'] or conf.env['WITH_NETCDF4_SRC']:
if conf.env['WITH_NETCDF_SRC']:
conf.msg("NetCDF source code path", ("%s " % conf.env['WITH_NETCDF_SRC']))
conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT']
conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF_SRC']
conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF'])
conf.env['LIB_NETCDF'] = ['netcdf_c++', 'netcdf']
conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++ netcdf', libpath=conf.env['WITH_NETCDF_LIB'], define_name='NETCDF_CPP', uselib_store='NETCDF_CPP', msg="Checking the given NETCDF library")
else:
conf.msg("NetCDF4 and HDF5 source code path", ("%s " % conf.env['WITH_NETCDF4_SRC']))
conf.env['DEFINES_NETCDF'] = ['WOSS_NETCDF_SUPPORT', 'WOSS_NETCDF4_SUPPORT']
conf.env['INCLUDES_NETCDF'] = conf.env['WITH_NETCDF4_SRC']
conf.env['LIBPATH_NETCDF'] = conf.env['WITH_NETCDF4_LIB']
conf.env.append_value('NS3_MODULE_PATH', conf.env['LIBPATH_NETCDF'])
conf.env['LIB_NETCDF'] = ['netcdf_c++4', 'netcdf', 'hdf5']
conf.env['NETCDF'] = conf.check(mandatory=True, lib='netcdf_c++4 netcdf hdf5', libpath=conf.env['WITH_NETCDF4_LIB'], define_name='NETCDF_CPP', uselib_store='NETCDF_CPP', msg="Checking the given NETCDF4 and HDF5 libraries")
else:
conf.msg("Checking for NetCDF/NetCDF4 source location", False)
conf.report_optional_feature("WOSS", "WOSS Integration Framework", True, "WOSS correctly configured")
def build(bld):
if 'woss-ns3' in bld.env['MODULES_NOT_BUILT']:
return
module = bld.create_ns3_module('woss-ns3', ['netanim', 'network', 'energy', 'mobility', 'uan'])
module.source = [
'model/definitions/woss-location.cc',
'model/definitions/woss-time-reference.cc',
'model/definitions/woss-random-generator.cc',
'model/woss-prop-model.cc',
'model/woss-channel.cc',
'model/woss-position-allocator.cc',
'model/woss-waypoint-mobility-model.cc',
'helper/woss-helper.cc',
]
module_test = bld.create_ns3_module_test_library('woss-ns3')
module_test.source = [
'test/woss-test.cc',
]
headers = bld(features='ns3header')
headers.module = 'woss-ns3'
headers.source = [
'model/definitions/woss-location.h',
'model/definitions/woss-time-reference.h',
'model/definitions/woss-random-generator.h',
'model/woss-prop-model.h',
'model/woss-channel.h',
'model/woss-position-allocator.h',
'model/woss-waypoint-mobility-model.h',
'helper/woss-helper.h',
]
if bld.env['WOSS']:
if bld.env['NETCDF']:
module.use.extend(['WOSS', 'NETCDF'])
module_test.use.extend(['WOSS', 'NETCDF'])
else:
module.use.extend(['WOSS'])
module_test.use.extend(['WOSS'])
if (bld.env['ENABLE_EXAMPLES']):
bld.recurse('examples')