-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
57 lines (41 loc) · 1.31 KB
/
meson.build
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
project('diablo', 'c',
license: 'Apache2',
version: '1.0',
default_options: ['c_std=c11', 'warning_level=3'])
# Programs
compiler = meson.get_compiler('c')
assert(compiler.get_id() == 'gcc' or compiler.get_id() == 'clang',
'Diablo only supports GCC and Clang.')
py = import('python')
testing_py = py.find_installation('python3',
modules: ['cffi', 'hypothesis'],
required: false
)
benching_py = py.find_installation('python3',
modules: ['cffi', 'pytest_benchmark'],
required:false
)
if benching_py.found()
pytest = find_program('pytest', '/usr/bin/pytest', '/usr/bin/pytest-3')
endif
# Library
srcs = files('src/count-eq.c')
libs = both_libraries('diablo', srcs)
# Tests
if testing_py.found()
test('count-eq', testing_py,
args: [files('test/count_eq.py'), libs.get_shared_lib().full_path()],
depends: libs.get_shared_lib()
)
endif
# Benchmarks
if benching_py.found()
count_eq_base_srcs = files('bench/count-eq-baseline.c')
count_eq_base_lib = shared_library('count-eq-baseline', count_eq_base_srcs)
run_target('count-eq-bench',
command: [pytest, files('bench/count_eq_bench.py')],
depends: [count_eq_base_lib, libs.get_shared_lib()],
env: { 'OPTIMIZED_LIB': libs.get_shared_lib().full_path(),
'FALLBACK_LIB': count_eq_base_lib.full_path() }
)
endif