generated from embeddedartistry/project-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
115 lines (93 loc) · 2.81 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
project('c-linked-list',
['c'],
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=c17', 'build.c_std=c17',
],
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')
if get_option('debug')
add_project_arguments('-DDEBUG',
language: ['c'])
add_project_arguments('-DDEBUG',
language: ['c'], 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('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},
]
link_settings_list = [
{'lang': 'c', 'compiler': host_c_compiler, 'flags': [], 'isnative': false},
{'lang': 'c', 'compiler': native_c_compiler, 'flags': [], 'isnative': true},
]
# Process the compilation flags
subdir('meson/compiler/check-and-apply-flags')
#################
# Build Modules #
#################
subdir('meson/test/cmocka')
#######################
# Process Source Tree #
#######################
# Add files to this variable if you want them analyzed by clang-tidy
clangtidy_files = []
subdir('src')
# Tests currently not implemented (issue #1)
# subdir('test')
###################
# 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')