-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmeson.build
78 lines (64 loc) · 1.83 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
project(
'Kalman SoC',
'cpp',
version: '0.0.1',
subproject_dir: 'dep'
)
# Import binary helpers
python = find_program('python3', 'python', required: false)
clangFormat = find_program('clang-format', required: false)
# Add Kalman filter source code
src_files = files([
'src/SoCKalman.cpp',
])
# Include kalman directory for main executable
kalman_inc = include_directories([
'.',
'src'
])
# Build the source library
kalman_lib = static_library(
'Kalman',
[ src_files ],
pic: false
)
# Build the backtesting tool executable
backtest = executable(
'backtest',
'backtest/main.cpp',
include_directories: [ kalman_inc ],
link_with: [ kalman_lib ],
native: true
)
# Only build examples and tests when not a subproject
if (meson.is_subproject() != true)
# Add unit test src
subdir('tests')
test_src_inc = get_variable('test_src_inc')
test_src_files = get_variable('test_src_files')
# Add CppUTest dependency
cpputest = subproject('cpputest')
cpputest_dep = cpputest.get_variable('cpputest_dep')
# Build native unit tests
run_tests = executable(
'run_tests',
[ test_src_files, src_files, './tests/main.cpp' ],
include_directories: [ test_src_inc ],
dependencies: [ cpputest_dep ],
native: true,
build_by_default: false
)
# Unit test
test('cpputest', run_tests)
# Setup custom build commands
run_target('lint', command: [ 'clang-format', '-verbose',
'-style=file', '-i', src_files,
test_src_files ])
endif
message('''
Build commands:
ninja compile
ninja clean clean
ninja lint prints a diff for files that do not match the style guide
'''
)