-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
107 lines (96 loc) · 2.5 KB
/
meson.build
File metadata and controls
107 lines (96 loc) · 2.5 KB
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
# SPDX-License-Identifier: BSD-3-Clause
project(
'discretize',
'cpp',
default_options: [
'buildtype=release',
'cpp_std=c++17',
'warning_level=3',
'b_ndebug=if-release',
'b_lto=true',
'strip=true'
],
license: 'BSD-3-Clause',
version: '0.0.1',
meson_version: '>= 1.0.0',
subproject_dir: 'deps'
)
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')
compiler_version = cxx.version()
yosys_datdir = get_option('yosys_datdir')
yosys_cxxflags = ''
if yosys_datdir == ''
yosys_config = find_program('yosys-config', required: false)
if yosys_config.found()
yosys_datdir = run_command(yosys_config, '--datdir', check: true).stdout().strip()
yosys_cxxflags = run_command(yosys_config, '--cxxflags', check: true).stdout().strip()
endif
endif
yosys_incdir = yosys_datdir / 'include'
yosys_plugindir = yosys_datdir / 'plugins'
yosys_defines = []
yosys_incs = []
foreach elem : yosys_cxxflags.split()
if elem.startswith('-D')
yosys_defines += elem
elif elem.startswith('-I')
yosys_incs += elem.strip('-I').strip('"')
endif
endforeach
message('Yosys data dir `@0@`'.format(yosys_datdir))
message('Yosys include dir `@0@`'.format(yosys_incdir))
message('Yosys plugin dir `@0@`'.format(yosys_plugindir))
subdir('contrib')
subdir('src')
if get_option('build_tests')
subdir('tests')
endif