-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
355 lines (307 loc) · 12.7 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#!/usr/bin/env python
import argparse
import os
import time
from os.path import join
from socket import gethostname
from waflib.extras.test_base import summary
from waflib.extras.symwaf2ic import get_toplevel_path
from waflib.extras.symwaf2ic import describe_project
def depends(dep):
if getattr(dep.options, 'with_hxcomm_hostarq', True):
dep('sctrltp')
dep('rant')
dep('hate')
dep('hwdb')
dep('code-format')
dep('logger')
dep('visions-slurm', branch='production')
dep('flange')
dep('lib-rcf')
dep('bss-hw-params')
def recurse(deps, name, alldeps):
for subname in deps[name]:
if subname not in alldeps:
alldeps.add(subname)
recurse(deps, subname, alldeps)
alldeps = set()
recurse(dep.dependencies, dep.path.abspath(), alldeps)
global _dependencies
_dependencies = set(
ctx.replace(dep.toplevel.abspath() + "/", "").split("/")[0] for ctx in alldeps)
def options(opt):
opt.load('compiler_c')
opt.load('compiler_cxx')
opt.load('boost')
opt.load("test_base")
opt.load("gtest")
opt.load("doxygen")
opt.recurse('pyhxcomm')
hopts = opt.add_option_group('hxcomm options')
hopts.add_option("--hxcomm-loglevel",
choices=["trace", "debug", "info", "warning", "error", "fatal"],
default="info",
help="Maximal loglevel to compile in.")
hopts.add_withoption('munge', default=False,
help='Toggle build of quiggeldy with munge-based '
'authentification support')
hopts.add_withoption('quiggeldy', default=True,
help='Toggle build of quiggeldy-tool '
'(has extra dependencies).')
hopts.add_withoption('hxcomm-python-bindings', default=True,
help='Toggle the generation and build of hxcomm python bindings')
hopts.add_withoption('hxcomm-hostarq', default=True,
help='Toggle support for HostARQ-based connections')
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.load('boost')
conf.check_boost(lib='program_options', uselib_store='BOOST4HXCOMMTOOLS')
conf.load("test_base")
conf.load("gtest")
conf.check_cxx(mandatory=True, header_name='cereal/cereal.hpp')
conf.load("doxygen")
conf.env.build_with_hostarq = conf.options.with_hxcomm_hostarq
conf.env.DEFINES_HXCOMM = [
"HXCOMM_LOG_THRESHOLD=" +
{'trace': '0',
'debug': '1',
'info': '2',
'warning': '3',
'error': '4',
'fatal': '5'}[conf.options.hxcomm_loglevel],
'HXCOMM_REPO_STATE="' + "; ".join([
describe_project(conf, dep).replace('"', '\\"') for dep in _dependencies] +
[describe_project(conf, 'hxcomm').replace('"', '\\"') + '"'])
]
if conf.env.build_with_hostarq:
conf.env.DEFINES_HXCOMM.append('WITH_HXCOMM_HOSTARQ')
conf.env.CXXFLAGS_HXCOMM = [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
]
conf.env.LINKFLAGS_HXCOMM = [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
]
conf.env.build_with_munge = conf.options.with_munge
if conf.env.build_with_munge:
conf.check_cxx(lib="munge",
header_name="munge.h",
msg="Checking for munge",
uselib_store="MUNGE")
conf.env.DEFINES_MUNGE = ["USE_MUNGE_AUTH"]
conf.env.build_with_quiggeldy = conf.options.with_quiggeldy
if conf.env.build_with_quiggeldy:
conf.check_boost(lib='program_options system',
uselib_store='BOOST4QUIGGELDY')
conf.check_cxx(lib="pthread", uselib_store="PTHREAD")
if getattr(conf.options, 'with_hxcomm_python_bindings', True):
conf.recurse("pyhxcomm")
conf.check_cfg(package='yaml-cpp',
args=['yaml-cpp >= 0.5.3', '--cflags', '--libs'],
uselib_store='YAMLCPP')
def build_loopbackconnection_test(bld):
"""
Build Loopbackconnection tests for a variety of parameter combinations.
This is done via defines so that each target's build time is reduced
and parallel build can be executed.
"""
loopbackconnection_obj_targets = []
types = ['uint8_t', 'uint16_t', 'uint32_t', 'uint64_t']
header_alignments = [1, 3, 8]
for subword_type in types:
for phyword_type in types:
for header_alignment in header_alignments:
target = 'hxcomm_loopbackconnection_obj_' + subword_type + \
'_' + phyword_type + '_' + str(header_alignment)
bld(
target = target,
features = 'cxx',
source = 'tests/sw/hxcomm/test-loopbackconnection.cpp',
defines = ['SUBWORD_TYPE=' + subword_type,
'PHYWORD_TYPE=' + phyword_type,
'HEADER_ALIGNMENT=' + str(header_alignment)],
use = ['hxcomm', 'hxcomm_tests_helper'],
)
loopbackconnection_obj_targets.append(target)
return loopbackconnection_obj_targets
def build(bld):
bld.env.BBS_HARDWARE_AVAILABLE = "SLURM_HWDB_YAML" in os.environ
bld.env.DLSvx_SIM_AVAILABLE = "FLANGE_SIMULATION_RCF_PORT" in os.environ
use_munge = ["MUNGE"] if bld.env.build_with_munge else []
use_hostarq = ["arqstream_obj"] if bld.env.build_with_hostarq else []
bld(target = 'hxcomm_inc',
export_includes = 'include'
)
hxcomm_excludes = []
if not bld.env.build_with_hostarq:
hxcomm_excludes.append('src/hxcomm/**/arqconnection.cpp')
bld.shlib(
target = 'hxcomm',
source = bld.path.ant_glob('src/hxcomm/**/*.cpp', excl=hxcomm_excludes),
use = ['hxcomm_inc',
'flange', 'rant', 'hate_inc', 'logger_obj',
'visions-slurm_inc', 'hwdb4cpp', 'YAMLCPP',
'bss-hw-params_inc', 'rcf-sf-only', 'rcf_extensions',
] + use_munge + use_hostarq,
uselib = 'HXCOMM',
install_path = '${PREFIX}/lib',
export_defines=bld.env.DEFINES_HXCOMM,
)
if use_hostarq:
bld(
target = 'hxcomm_example_arq',
features = 'cxx cxxprogram',
source = ['example/hxcomm_arq.cpp'],
use = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
install_path = '${PREFIX}/bin',
uselib = 'HXCOMM',
)
bld(
target = 'hxcomm_example_sim',
features = 'cxx cxxprogram',
source = ['example/hxcomm_sim.cpp'],
use = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
install_path = '${PREFIX}/bin',
uselib = 'HXCOMM',
)
bld(
target = 'hxcomm_example_loopback_throughput',
features = 'cxx cxxprogram',
source = ['example/hxcomm_loopback_throughput.cpp'],
use = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
install_path = '${PREFIX}/bin',
uselib = 'HXCOMM',
)
bld(
target = 'hxcomm_example_zeromock_throughput',
features = 'cxx cxxprogram',
source = ['example/hxcomm_zeromock_throughput.cpp'],
use = ['hxcomm', 'BOOST4HXCOMMTOOLS'],
install_path = '${PREFIX}/bin',
uselib = 'HXCOMM',
)
bld(
target = 'hxcomm_tests_inc',
export_includes = 'tests/common/include'
)
bld.shlib(
target = 'hxcomm_tests_helper',
features = 'cxx',
source = bld.path.ant_glob('tests/common/src/test-*.cpp'),
use = ['hxcomm', 'hxcomm_tests_inc', 'logger_obj'],
)
loopbackconnection_obj_targets = build_loopbackconnection_test(bld)
bld(
target = 'hxcomm_swtest',
features = 'gtest cxx cxxprogram',
source = bld.path.ant_glob('tests/sw/hxcomm/test-*.cpp',
excl='tests/sw/hxcomm/test-*_throughput.cpp tests/sw/hxcomm/test-loopbackconnection.cpp'),
use = ['hxcomm', 'hxcomm_tests_helper', 'BOOST4HXCOMMTOOLS'] + loopbackconnection_obj_targets,
test_timeout = 120,
uselib = 'HXCOMM',
test_main = 'tests/common/src/main.cpp',
)
bld(
target = 'hxcomm_throughputtest',
features = 'gtest cxx cxxprogram',
source = bld.path.ant_glob('tests/sw/hxcomm/test-*_throughput.cpp'),
use = ['hxcomm', 'hxcomm_tests_helper', 'BOOST4HXCOMMTOOLS'],
test_main = 'tests/common/src/main.cpp',
cxxflags = ['-O2'],
# Throughput targets are only valid for HBPHosts and AMTHosts
skip_run = not (gethostname().startswith("HBPHost") or
gethostname().startswith("AMTHost")),
uselib = 'HXCOMM',
)
bld(
target = 'hxcomm_backendtest',
features = 'gtest cxx cxxprogram',
source = bld.path.ant_glob('tests/hw/hxcomm/test-*.cpp'),
skip_run = not (bld.env.BBS_HARDWARE_AVAILABLE or bld.env.DLSvx_SIM_AVAILABLE),
test_main = 'tests/common/src/main.cpp',
use = ['hxcomm', 'hxcomm_tests_helper', 'BOOST4HXCOMMTOOLS'],
test_timeout = 120,
uselib = 'HXCOMM',
)
bld(target = 'hxcomm_zeromocktests_inc',
export_includes = 'tests/hw/hxcomm/connection_zeromock'
)
bld(
target = 'hxcomm_zeromocktests',
features = 'gtest cxx cxxprogram',
source = bld.path.ant_glob('tests/hw/hxcomm/test-*.cpp'),
test_main = 'tests/common/src/main.cpp',
use = ['hxcomm', 'hxcomm_tests_helper', 'hxcomm_zeromocktests_inc', 'BOOST4HXCOMMTOOLS'],
uselib = 'HXCOMM',
test_timeout = 180,
test_environ = dict(HXCOMM_ENABLE_ZERO_MOCK='1'),
)
if bld.env.build_with_quiggeldy:
use_quiggeldy = ["hxcomm", "BOOST4QUIGGELDY", "PTHREAD"] + use_munge
project_states = "\\n".join(sorted(map(lambda d: "* " + bld.describe_project(d), _dependencies)))
quiggeldy_version_string = "* {}\\n{}".format(
bld.describe_project("hxcomm"), project_states)
bld(
target = 'quiggeldy',
features = 'cxx cxxprogram',
source = [
bld.path.find_node('src/tools/quiggeldy_binary.cpp'),
],
use = use_quiggeldy,
install_path = 'bin',
defines = ["QUIGGELDY_VERSION_STRING=" + quiggeldy_version_string],
)
bld(
target = 'quiggeldy_mock_client',
features = 'cxx cxxprogram',
source = [
bld.path.find_node('src/tools/quiggeldy_mock_client.cpp'),
],
use = use_quiggeldy,
uselib = 'HXCOMM',
install_path = 'bin',
)
bld(
target = 'viggeldy',
features = 'cxx cxxprogram',
source = [
bld.path.find_node('src/tools/quiggeldy_query_version.cpp'),
],
use = use_quiggeldy,
uselib = 'HXCOMM',
install_path = '${PREFIX}/bin',
)
bld.symlink_as("${PREFIX}/bin/quiggeldy_query_version", "viggeldy",
name="quiggeldy_query_version", depends_on="viggeldy")
bld(
target = 'wriggeldy',
features = 'cxx cxxprogram',
source = [
bld.path.find_node('src/tools/wrap_with_quiggeldy.cpp'),
],
use = use_quiggeldy,
depends_on = "quiggeldy",
install_path = 'bin',
)
bld.symlink_as("${PREFIX}/bin/wrap_with_quiggeldy", "wriggeldy",
name="wrap_with_quiggeldy", depends_on="wriggeldy")
if bld.env.DOXYGEN:
bld(
target = 'doxygen_hxcomm',
features = 'doxygen',
doxyfile = bld.root.make_node(join(get_toplevel_path(), "code-format", "doxyfile")),
doxy_inputs = 'include/hxcomm',
install_path = 'doc/hxcomm',
pars = {
"PROJECT_NAME": "\"HX Communication\"",
"PREDEFINED": "SYMBOL_VISIBLE=",
"INCLUDE_PATH": join(get_toplevel_path(), "hxcomm", "include"),
"OUTPUT_DIRECTORY": join(get_toplevel_path(), "build", "hxcomm", "doc")
},
)
if getattr(bld.options, 'with_hxcomm_python_bindings', True):
bld.recurse('pyhxcomm')
# Create test summary (to stdout and XML file)
bld.add_post_fun(summary)