-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
162 lines (133 loc) · 4.9 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
project('embvm-blinky-demo',
['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.58.0',
version: '1.0'
)
################################
# Project Options and Settings #
################################
# Pick up our common compiler variables + desired_*_flags variables
subdir('meson/compiler')
subdir('meson/compiler/c')
subdir('meson/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'
desired_native_cpp_compile_flags += '-fno-rtti'
endif
if get_option('disable-exceptions')
desired_cpp_compile_flags += ['-fno-exceptions', '-fno-unwind-tables']
desired_native_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('meson/compiler/check-and-apply-flags')
#################
# Build Modules #
#################
# Include reusable build modules here via subdir() calls
subdir('meson/linker/linker-script-as-property')
subdir('meson/linker/linker-map')
subdir('meson/test/cmocka')
subdir('meson/objcopy')
###############
# Subprojects #
###############
embvm_demo_platforms_subproject = subproject('embvm-demo-platforms')
blinky_sim_platform_dep = embvm_demo_platforms_subproject.get_variable('blinky_sim_platform_dep')
if host_machine.cpu_family() == 'x86_64'
blinky_sim_x86_platform_dep = embvm_demo_platforms_subproject.get_variable('blinky_sim_x86_platform_dep')
endif
if host_machine.cpu_family() == 'arm'
blinky_nrf52dongle_platform_dep = embvm_demo_platforms_subproject.get_variable('blinky_nrf52dongle_platform_dep')
blinky_nrf52dk_platform_dep = embvm_demo_platforms_subproject.get_variable('blinky_nrf52dk_platform_dep')
endif
# TODO: these are only required for the ARM examples... is this needed here?
# or do we need a dependency refactor?
embvm_core_subproject = subproject('embvm-core')
framework_dep = embvm_core_subproject.get_variable('framework_dep')
framework_threadless_dep = embvm_core_subproject.get_variable('framework_threadless_dep')
# Configure the project to include `libc` headers by default
#######################
# Process Source Tree #
#######################
# Add files to this variable if you want them analyzed by clang-tidy
clangtidy_files = []
# Add dependencies to this array for testing with Catch2
catch2_tests_dep = []
subdir('src')
subdir('test')
# Defined after src and test so catch2_dep is fully populated
# when creating the built-in targets
subdir('meson/test/catch2')
###################
# Tooling Modules #
###################
subdir('meson/analysis/clang-tidy')
subdir('meson/analysis/complexity')
subdir('meson/analysis/cppcheck')
subdir('meson/analysis/sloccount')
subdir('meson/analysis/vale')
subdir('meson/format')
subdir('meson/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.project_build_root() + ':@0@'
app_include = meson.project_build_root() / 'src/app:@0@'
lib_include = meson.project_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('meson/package')