-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
executable file
·201 lines (171 loc) · 6.28 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
#!/usr/bin/env python
import sys, os, copy
from subprocess import check_output, CalledProcessError
from waflib import Utils
from waflib.extras import symwaf2ic
from waflib.extras.gtest import summary
APPNAME='sthal'
def depends(ctx):
ctx('halbe')
ctx('calibtic')
ctx('redman')
ctx('logger')
ctx('hwdb')
def options(opt):
opt.load('compiler_cxx')
opt.load('boost')
opt.load('gtest')
opt.load('doxygen')
def configure(cfg):
cfg.load('compiler_cxx')
cfg.load('boost')
cfg.load('gtest')
cfg.load('doxygen')
cfg.check_cxx(lib='rt', uselib_store='RT')
cfg.check_cxx(lib='gomp', cxxflags='-fopenmp', linkflags='-fopenmp', uselib_store='OPENMP4STHAL')
cfg.check_cxx(lib='tbb', uselib_store='TBB4STHAL', mandatory=1)
def build(bld):
bld.add_post_fun(summary)
bld(
target = 'sthal_inc',
export_includes = ['.'],
)
# always re-check git version, user could have changed stuff at arbitrary times
try:
cmd = [bld.env.get_flat('GIT'), 'describe', '--long', '--dirty', '--always', '--abbrev=32']
git_version = check_output(cmd, cwd=bld.path.abspath()).rstrip()
except CalledProcessError:
git_version = "unversioned_build"
bld(
rule = 'echo \'char const * STHAL_GIT_VERSION = "%s";\' > ${TGT}' % git_version,
target = 'sthal_git_version.h',
export_includes = [bld.path.get_bld()],
)
sthal_sources = bld.path.ant_glob('sthal/**/*.cpp', excl='sthal/**/*ESS*.cpp sthal/**/*Ess*.cpp')
if bld.env.build_ess:
sthal_sources += bld.path.ant_glob('sthal/**/*ESS*.cpp sthal/**/*Ess*.cpp')
else:
# ESSConfig is always needed by PyMarocco
sthal_sources += bld.path.ant_glob('sthal/ESSConfig.cpp')
datadir = os.path.abspath(os.path.join(bld.options.prefix, 'share'))
datadirsrc = bld.path.find_dir('share')
bld.install_files(
datadir,
files=datadirsrc.ant_glob('**/*'),
cwd=datadirsrc,
relative_trick=True,
)
bld.shlib(
target = 'sthal',
features = 'pyembed',
source = sthal_sources,
export_includes = ['.'],
install_path = '${PREFIX}/lib', # avoid lib/lib64 problems
use = [
'sthal_inc',
'halbe',
'hmf_calibration',
'sthal_git_version.h',
'hwdb4cpp',
'TBB4STHAL',
'redman',
'OPENMP4STHAL',
],
defines = ['DATADIR="{}"'.format(datadir)],
)
bld(
target = 'sthal_tests',
features = 'gtest cxx cxxprogram pyembed',
source = bld.path.ant_glob('tests/**/sthal_test_*.cpp'),
use = ['sthal', 'logger_obj', 'hwtest_obj', 'RT'],
install_path='${PREFIX}/bin',
test_environ = {
'NMPM_DATADIR': datadirsrc.abspath(),
},
)
bld(
target = 'sthal_multi_fpga_loopback_hwtest',
features = 'cxx cxxprogram pyembed',
source = 'tests/sthal_multi_fpga_loopback_hwtest.cpp',
use = ['sthal', 'logger_obj', 'hwtest_obj', 'RT'],
install_path = '${PREFIX}/bin',
)
bld(
target = 'sthal_hwtests',
features = 'cxx cxxprogram pyembed gtest',
source = bld.path.ant_glob('tests/**/sthal_hwtest_*.cpp'),
use = ['sthal', 'logger_obj', 'hwtest_obj', 'RT', 'GTEST'],
install_path ='${PREFIX}/bin',
skip_run = True,
)
if bld.env.build_ess:
bld(
target = 'run_waferdump_in_ess',
features = 'pyembed cxx cxxprogram',
source = 'tools/run_waferdump_in_ess.cpp',
use = ['sthal', 'BOOST4TOOLS'],
install_path='${PREFIX}/bin',
)
bld.install_files(
'${PREFIX}/bin',
bld.path.ant_glob('tools/*', excl='tools/*.cpp'),
relative_trick=False,
chmod=Utils.O755,
)
bld.symlink_as('${PREFIX}/bin/cube_sbatch', 'cube_srun')
if bld.env.build_python_bindings:
bld(
target = '_pysthal',
features = 'cxx cxxshlib pypp pyembed pyext',
script = 'pysthal/generate.py',
gen_defines = 'PYPLUSPLUS __STRICT_ANSI__',
defines = 'PYBINDINGS',
headers = 'pysthal/pysthal.h',
use = ['sthal', 'pyhalbe', 'pyhwdb'],
install_path = '${PREFIX}/lib',
cxxflags = [
'-Wno-unused-local-typedefs',
'-fvisibility=hidden',
],
)
bld(
target = 'pysthal',
features = 'use py',
use = '_pysthal',
source = bld.path.ant_glob('pysthal/pysthal/**/*.py'),
relative_trick = True,
install_from = 'pysthal',
install_path = '${PREFIX}/lib'
)
bld(
name = "pysthal_test_dep",
source = 'tests/PysthalTest.py',
features = 'py',
install_from = 'tests',
install_path = '${PREFIX}/lib',
)
bld(
name = "pysthal_tests",
tests = bld.path.ant_glob('tests/sthal_test_*.py'),
features = 'use pytest',
use = ['pysthal', 'pysthal_test_dep', 'pyhalbe_test_dep',
'pylogging', 'pyredman', 'redman_xml'],
install_path = '${PREFIX}/bin',
test_timeout = 60,
prepend_to_path = ["tools"],
test_environ = {
'NMPM_DATADIR': datadirsrc.abspath(),
},
)
bld.install_files(
'${PREFIX}/bin',
bld.path.ant_glob('tests/sthal_hwtest_*.py'),
relative_trick=False,
chmod=Utils.O755,
)
bld.add_post_fun(summary)
def doc(dox):
'''build documentation (doxygen)'''
dox(features = 'doxygen',
doxyfile = 'doc/doxyfile',
pars={ 'INPUT': dox.path.get_src().abspath() + '/sthal', })