-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmeson.build
85 lines (80 loc) · 2.1 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
79
80
81
82
83
84
85
#
# Set project name, version and C++ level
#
project('dubna', ['cpp', 'c'],
version: '0.1',
meson_version: '>=1.1',
default_options: [
'buildtype=debugoptimized',
'cpp_std=c++17',
'warning_level=3',
]
)
#
# Get git commit hash and revision count
#
hash = run_command('git', 'log', '-1', '--format=%h', check: true).stdout().strip()
revcount = run_command('git', 'rev-list', 'HEAD', '--count', check: true).stdout().strip()
#
# Build library
#
simulator = static_library('simulator',
[
'tapes/bemsh.739.c',
'tapes/librar.12.c',
'tapes/librar.37.c',
'tapes/monsys.9.c',
'session.cpp',
'memory.cpp',
'machine.cpp',
'processor.cpp',
'arithmetic.cpp',
'besm6_arch.cpp',
'assembler.cpp',
'extracode.cpp',
'trace.cpp',
'drum.cpp',
'disk.cpp',
'e50.cpp',
'e57.cpp',
'e64.cpp',
'encoding.cpp',
'plotter.cpp',
'puncher.cpp',
'cosy.cpp',
],
cpp_args: [
'-Werror',
'-Wshadow',
'-DVERSION_STRING="' + meson.project_version() + '.' + revcount + '-' + hash + '"'
]
)
#
# Build executable file
#
executable('dubna', 'main.cpp',
cpp_args: [ '-Wshadow' ],
link_with: simulator,
install: true,
)
#
# Run cppcheck
#
run_target('cppcheck', command: [
'cppcheck',
'--project=' + join_paths(meson.project_build_root(), 'compile_commands.json'),
'--std=c++17',
'--enable=style',
'--check-level=exhaustive',
'--error-exitcode=1', # Fail on any issues
'--inline-suppr', # Enable inline control like // cppcheck-suppress 'id'
'--quiet', # No progress report messages
'--suppress=badBitmaskCheck', # Allow redundant zero operands
'--suppress=*:*/gtest/*', # Ignore issues in Googletest
'--library=' + join_paths(meson.project_source_root(), 'tests/googletest.xml'), # Parse TEST() macro properly
]
)
# Tests are defined in 'tests/meson.build' file
if (get_option('tests').allowed())
subdir('tests')
endif