-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
139 lines (111 loc) · 3.67 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
project('PROJECT_NAME',
['c', 'cpp'],
default_options : [
'warning_level=3',
'werror=false',
# This project defaults to a release build
'debug=false',
'optimization=2',
# `build.*` options affect `native: true targets`
# plain options affect `native: false` targets.
'c_std=c11', 'build.c_std=c11',
'cpp_std=c++17', 'build.cpp_std=c++17',
],
meson_version: '>=0.54.0',
version: '0.1'
)
################################
# Project Options and Settings #
################################
# Pick up our common compiler variables + desired_*_flags variables
subdir('build/compiler')
subdir('build/compiler/c')
subdir('build/compiler/cpp')
if get_option('debug')
add_project_arguments('-DDEBUG',
language: ['c', 'cpp'])
add_project_arguments('-DDEBUG',
language: ['c', 'cpp'], native: true)
endif
if get_option('disable-builtins')
desired_common_compile_flags += '-fno-builtin'
endif
if get_option('disable-stack-protection')
desired_common_compile_flags += '-fno-stack-protector'
endif
if get_option('disable-rtti')
desired_cpp_compile_flags += '-fno-rtti'
endif
if get_option('disable-exceptions')
desired_cpp_compile_flags += ['-fno-exceptions', '-fno-unwind-tables']
endif
if get_option('enable-pedantic')
desired_common_compile_flags += '-pedantic'
else
desired_common_compile_flags += '-Wno-pedantic'
endif
if get_option('enable-pedantic-error')
desired_common_compile_flags += '-pedantic-error'
endif
compile_settings_list = [
{'lang': 'c', 'compiler': host_c_compiler, 'flags': desired_c_compile_flags, 'isnative': false},
{'lang': 'c', 'compiler': native_c_compiler, 'flags': desired_native_c_compile_flags, 'isnative': true},
{'lang': 'cpp', 'compiler': host_cpp_compiler, 'flags': desired_cpp_compile_flags, 'isnative': false},
{'lang': 'cpp', 'compiler': native_cpp_compiler, 'flags': desired_native_cpp_compile_flags, 'isnative': true},
]
link_settings_list = [
{'lang': 'c', 'compiler': host_c_compiler, 'flags': [], 'isnative': false},
{'lang': 'c', 'compiler': native_c_compiler, 'flags': [], 'isnative': true},
{'lang': 'cpp', 'compiler': host_cpp_compiler, 'flags': [], 'isnative': false},
{'lang': 'cpp', 'compiler': native_cpp_compiler, 'flags': [], 'isnative': true},
]
# Process the compilation flags
subdir('build/compiler/check-and-apply-flags')
#################
# Build Modules #
#################
# Include reusable build modules here via subdir() calls
subdir('build/linker/linker-script-as-property')
subdir('build/linker/linker-map')
subdir('build/objcopy')
###############
# Subprojects #
###############
#######################
# Process Source Tree #
#######################
# Add files to this variable if you want them analyzed by clang-tidy
clangtidy_files = []
subdir('src')
###################
# Tooling Modules #
###################
subdir('build/analysis/clang-tidy')
subdir('build/analysis/complexity')
subdir('build/analysis/cppcheck')
subdir('build/analysis/sloccount')
subdir('build/analysis/vale')
subdir('build/format')
doxygen_input = [meson.source_root() / 'src']
doxyfile_input = files(meson.source_root() / 'docs/Doxyfile.in')
subdir('build/docs/doxygen')
#############
# Packaging #
#############
# These macros allow you to simplify the declaration of includes for common
# include paths. Examples:
# build_root_include.format('doc'),
# app_include.format('APP')
build_root_include = meson.build_root() + ':@0@'
app_include = meson.build_root() / 'src/app:@0@'
lib_include = meson.build_root() / 'src/lib:@0@'
host_pkg_files = [
build_root_include.format('docs'),
app_include.format('APP')
]
native_pkg_files = [
build_root_include.format('docs'),
app_include.format('APP_native')
]
# Invoke the package module
subdir('build/package')