-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwscript
More file actions
220 lines (192 loc) · 7.6 KB
/
Copy pathwscript
File metadata and controls
220 lines (192 loc) · 7.6 KB
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
from enum import Enum, auto
import os
from os.path import join
from waflib.extras.test_base import summary
from waflib.extras.symwaf2ic import get_toplevel_path
import yaml
import re
from waflib.Errors import BuildError
def depends(dep):
dep('hate')
dep('halco')
dep('hxcomm')
dep('code-format')
dep('logger')
if getattr(dep.options, 'with_fisch_python_bindings', True):
dep.recurse('pyfisch')
dep('libnux')
def options(opt):
opt.load('compiler_cxx')
opt.load('gtest')
opt.load('test_base')
opt.load("doxygen")
opt.recurse('pyfisch')
hopts = opt.add_option_group('fisch options')
hopts.add_option("--fisch-loglevel",
choices=["trace", "debug", "info",
"warning", "error", "fatal"],
default="warning",
help="Maximal loglevel to compile in.")
hopts.add_withoption('fisch-python-bindings', default=True,
help='Toggle the generation and build of fisch python bindings')
hopts.add_option("--fisch-loglevel-syslog",
choices=["debug", "info",
"warning", "error", "fatal"],
default="warning",
help="Maximal loglevel for syslog to compile in.")
def configure(cfg):
cfg.load('compiler_cxx')
cfg.load('gtest')
cfg.load('test_base')
cfg.load("doxygen")
cfg.check_boost(lib='program_options', uselib_store='BOOST4FISCHTOOLS')
if getattr(cfg.options, 'with_fisch_python_bindings', True):
cfg.recurse('pyfisch')
cfg.define(
"FISCH_LOG_THRESHOLD",
{'trace': 0,
'debug': 1,
'info': 2,
'warning': 3,
'error': 4,
'fatal': 5}[cfg.options.fisch_loglevel],
"FISCH_SYSLOG_THRESHOLD",
{'debug': 0,
'info': 1,
'warning': 2,
'error': 3,
'none': 999
}[cfg.options.fisch_loglevel_syslog]
)
cfg.env.CXXFLAGS_FISCH = [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
]
cfg.env.LINKFLAGS_FISCH = [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
]
def build(bld):
class TestTarget(Enum):
SOFTWARE_ONLY = auto()
HARDWARE = auto()
SIMULATION = auto()
if "FLANGE_SIMULATION_RCF_PORT" in os.environ:
bld.env.TEST_TARGET = TestTarget.SIMULATION
try:
chip_revision = int(os.environ.get("SIMULATED_CHIP_REVISION"))
except TypeError:
raise BuildError("Environment variable 'SIMULATED_CHIP_REVISION' "
"not set or cannot be casted to integer.")
bld.env.CURRENT_SETUP = dict(chip_revision=chip_revision)
elif "SLURM_HWDB_YAML" in os.environ:
bld.env.TEST_TARGET = TestTarget.HARDWARE
slurm_licenses = os.environ.get("SLURM_HARDWARE_LICENSES")
hwdb_entries = os.environ.get("SLURM_HWDB_YAML")
fpga_id = int(re.match(r"W(?P<wafer>\d+)F(?P<fpga>\d+)",
slurm_licenses)["fpga"])
fpgas = yaml.full_load(hwdb_entries)["fpgas"]
fpga = None
for entry in fpgas:
if entry["fpga"] == fpga_id:
fpga = entry
break
if not fpga:
raise BuildError("FPGA not found in hwdb")
bld.env.CURRENT_SETUP = fpga
else:
bld.env.TEST_TARGET = TestTarget.SOFTWARE_ONLY
bld.env.CURRENT_SETUP = dict(chip_revision=None)
bld.install_files(
dest = '${PREFIX}/',
files = bld.path.ant_glob('include/fisch/**/*.(h|tcc|def)'),
name = 'fisch_header',
relative_trick = True
)
bld(
target = 'fisch_inc',
export_includes = 'include',
depends_on = 'fisch_header'
)
if bld.env.have_ppu_toolchain:
env = bld.all_envs['nux_vx'].derive()
env.detach()
bld.stlib(
source = [
'src/fisch/vx/word_access/type/omnibus.cpp',
'src/fisch/vx/word_access/type/jtag.cpp',
],
target = 'fisch_ppu_vx',
use = ['fisch_inc', 'hate_inc', 'halco_hicann_dls_ppu_vx'],
env = env,
linkflags = '-Wl,-z,defs',
uselib='FISCH',
install_path = '${PREFIX}/lib/ppu',
)
for hx_version in [3]:
bld.shlib(
source = bld.path.ant_glob('src/fisch/vx/**/*.cpp'),
target = f'fisch_vx_v{hx_version}',
use = ['fisch_inc', 'hxcomm', 'halco_hicann_dls_vx', 'logger'],
defines = [f'FISCH_VX_CHIP_VERSION={hx_version}'],
uselib='FISCH',
)
bld.shlib(
source = bld.path.ant_glob('src/cereal/types/fisch/vx/**/*.cpp'),
target = f'fisch_vx_v{hx_version}_serialization',
use = [f'fisch_vx_v{hx_version}', 'hxcomm', 'halco_hicann_dls_vx'],
defines = [f'FISCH_VX_CHIP_VERSION={hx_version}'],
)
bld(
features = 'cxx cxxprogram gtest',
source = bld.path.ant_glob('tests/sw/fisch/vx/test-*.cpp'),
target = f'fisch_swtest_vx_v{hx_version}',
use = [f'fisch_vx_v{hx_version}', 'BOOST4FISCHTOOLS', f'fisch_vx_v{hx_version}_serialization'],
test_main = 'tests/sw/fisch/vx/main.cpp',
defines = [f'FISCH_VX_CHIP_VERSION={hx_version}'],
uselib='FISCH',
)
bld(
features = 'cxx cxxprogram gtest',
source = bld.path.ant_glob('tests/hw/fisch/vx/test-*.cpp'),
target = f'fisch_hwsimtest_vx_v{hx_version}',
use = [f'fisch_vx_v{hx_version}', 'BOOST4FISCHTOOLS'],
test_main = 'tests/hw/fisch/vx/main.cpp',
skip_run = (bld.env.TEST_TARGET == TestTarget.SOFTWARE_ONLY or
not (int(bld.env.CURRENT_SETUP["chip_revision"]) == hx_version)),
test_timeout = 3600 if bld.env.TEST_TARGET == TestTarget.SIMULATION else 30,
uselib='FISCH',
)
# like fisch_hwsimtest_vx but not for sim backend (because of 2x test time
# otherwise); the defines enforces a local quiggeldy if no remote quiggeldy
# is available => tests quiggeldy wrapping locally
bld(
features = 'cxx cxxprogram gtest',
source = bld.path.ant_glob('tests/hw/fisch/vx/test-*.cpp'),
target = f'fisch_qghwsimtest_vx_v{hx_version}',
use = [f'fisch_vx_v{hx_version}', 'BOOST4FISCHTOOLS'],
defines = ['FISCH_TEST_LOCAL_QUIGGELDY'],
test_main = 'tests/hw/fisch/vx/main.cpp',
skip_run = True, # Unstable tests, cf. issue #3976
depends_on = ["quiggeldy"],
test_timeout = 30,
uselib='FISCH',
)
if getattr(bld.options, 'with_fisch_python_bindings', True):
bld.recurse('pyfisch')
if bld.env.DOXYGEN:
bld(
target = 'doxygen_fisch',
features = 'doxygen',
doxyfile = bld.root.make_node(join(get_toplevel_path(), "code-format" ,"doxyfile")),
doxy_inputs = 'include/fisch',
install_path = 'doc/fisch',
pars = {
"PROJECT_NAME": "\"FPGA Instruction Set Compiler for HICANN\"",
"PREDEFINED": "GENPYBIND(...)= GENPYBIND_MANUAL(...)= SYMBOL_VISIBLE=",
"INCLUDE_PATH": join(get_toplevel_path(), "fisch", "include"),
"OUTPUT_DIRECTORY": join(get_toplevel_path(), "build", "fisch", "doc")
},
)
# Create test summary (to stdout and XML file)
bld.add_post_fun(summary)