-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
117 lines (105 loc) · 2.44 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
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
# SPDX-License-Identifier: BSD-3-Clause
project(
'clank',
'cpp',
default_options: [
'cpp_std=c++17',
'warning_level=3',
'build.cpp_std=c++17',
'buildtype=debugoptimized',
'strip=true',
'b_ndebug=if-release',
'b_lto=true'
],
subproject_dir: 'deps',
version: '0.0.1',
license: [
'BSD-3-Clause',
],
meson_version: '>=0.62.0',
)
cxx = meson.get_compiler('cpp')
if get_option('cpp_std') not in [
'c++17', 'c++20', 'c++23',
'gnu++17', 'gnu++20', 'gnu++23'
]
error('Unsupported C++ Version @0@, must be c++17/gnu++17 or newer'.format(get_option('cpp_std')))
endif
extended_warnings = [
'-Wdouble-promotion',
'-Wformat=2',
'-Wformat-overflow=2',
'-Wformat-signedness',
'-Wformat-truncation',
'-Wnull-dereference',
'-Wmissing-attributes',
'-Wmissing-braces',
'-Wsequence-point',
'-Wreturn-type',
'-Wunused',
'-Wunused-local-typedefs',
'-Wunused-const-variable=2',
'-Wmaybe-uninitialized',
'-Wunknown-pragmas',
'-Wstrict-aliasing',
'-Wstrict-overflow=3',
'-Wstring-compare',
'-Wstringop-overflow',
'-Warith-conversion',
'-Wvla-parameter',
'-Wduplicated-branches',
'-Wshadow=local',
'-Wunsafe-loop-optimizations',
'-Wbad-function-cast',
'-Wcast-qual',
'-Wcast-align=strict',
'-Wcast-function-type',
'-Wconversion',
'-Wdangling-else',
'-Wsign-conversion',
'-Wfloat-conversion',
'-Wredundant-decls',
'-Winline',
'-Wvla',
'-Wstack-protector',
'-Wunsuffixed-float-constant',
'-Wimplicit-fallthrough',
]
add_project_arguments(
cxx.get_supported_arguments(extended_warnings),
language: 'cpp'
)
is_clang = (cxx.get_id() == 'clang')
is_gcc = (cxx.get_id() == 'gcc')
is_windows = (target_machine.system() == 'windows')
compiler_verson = cxx.version()
if is_gcc and compiler_verson.version_compare('<11.0.0')
error('g++ version <= 11.0.0 is required to build Sawmill')
elif is_clang and compiler_verson.version_compare('<11.0.0')
error('clang++ version <= 11.0.0 is required to build Sawmill')
endif
subdir('src')
if get_option('build_tests')
subdir('tests')
endif
if get_option('build_examples') and not meson.is_subproject()
subdir('examples')
endif
subdir('docs')
clang_tidy = find_program('clang-tidy', required: false)
if clang_tidy.found()
clang_tidy_wrapper = find_program(
'clang-tidy.py',
dirs: [
meson.current_source_dir() / 'contrib'
]
)
run_target(
'clang-tidy',
command: [
clang_tidy_wrapper,
'-s', meson.current_source_dir(),
'-p', meson.current_build_dir()
]
)
endif