forked from embeddedartistry/libmemory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
142 lines (110 loc) · 4.18 KB
/
meson.build
File metadata and controls
142 lines (110 loc) · 4.18 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
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
project('Embedded Artistry libmemory',
['c', 'cpp'],
default_options : [
# `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',
],
license: 'MIT',
meson_version: '>0.51.0',
version: '1.0')
########################
# Identify Compiler(s) #
########################
# Identify compilers & get flags
subdir('build/compiler')
native_compiler = meson.get_compiler('c', native: true)
host_compiler = meson.get_compiler('c')
add_project_arguments(native_compiler_warnings, language: 'c', native: true)
add_project_arguments(target_compiler_warnings, language: 'c', native: false)
add_project_arguments(native_cpp_compiler_warnings, language: 'cpp', native: true)
add_project_arguments(target_cpp_compiler_warnings, language: 'cpp', native: false)
if native_compiler.has_argument('-Wno-reserved-id-macro')
# We are the standard library, don't complain about __ prefixes
add_project_arguments([compiler_args, '-Wno-reserved-id-macro'], language: ['c', 'cpp'], native: true)
endif
if host_compiler.has_argument('-Wno-reserved-id-macro')
# We are the standard library, don't complain about __ prefixes
add_project_arguments([compiler_args, '-Wno-reserved-id-macro'], language: ['c', 'cpp'], native: true)
endif
subdir('build/ea-stdlib')
#########################
# Process Build Options #
#########################
libc_target_include_directories = []
if get_option('use-external-stdlibs') == true
external_stdlib_path = get_option('external-stdlib-path')
message('Compiling with Embedded Artistry libc')
message('Looking for libc at location: ' + external_stdlib_path +
'. If libc is not found, update the external-stdlib-path configuration option.')
subdir('build/architecture')
message('Building libmemory for target architecture: ' + target_architecture)
libc_target_include_directories = [
include_directories(external_stdlib_path + '/include', is_system: true),
include_directories(external_stdlib_path + '/arch/' + target_architecture + '/include', is_system: true)
]
message('Building libmemory for native architecture: ' + native_architecture)
libc_native_include_directories = [
include_directories(external_stdlib_path + '/include', is_system: true),
include_directories(external_stdlib_path + '/arch/' + native_architecture + '/include', is_system: true)
]
endif
if get_option('enable-werror') == true
add_project_arguments('-Werror', language : 'c')
endif
if get_option('enable-pedantic-error') == true
add_project_arguments('-pedantic-error', language : 'c')
endif
#######################
# Process source tree #
#######################
# Used for local builds - we want the warnings
libmemory_includes = include_directories('include')
# Used for external builds - treat the headers as system headers
libmemory_system_includes = include_directories('include', is_system: true)
# Install headers
subdir('include/')
# Library build definition
subdir('src/')
# Test build definition
subdir('test/')
############################
# Supporting Build Targets #
############################
run_target('docs',
command: ['doxygen', 'docs/Doxyfile'])
run_target('complexity',
command: ['tools/complexity_check.sh', '-w'])
run_target('complexity-list',
command: ['tools/complexity_check.sh'])
cppcheck = find_program('cppcheck', required: false)
if cppcheck.found()
run_target('cppcheck',
command: ['cppcheck',
# Options
'--quiet', '--enable=style', '--force',
# Include Directories
'-I', meson.current_source_dir() + '/include',
'-I', meson.current_source_dir() + '/dependencies/lib',
# Source Directories
'src', 'test']
)
run_target('cppcheck-xml',
command: ['tools/cppcheck_xml.sh']
)
endif
clangtidy = find_program('clang-tidy', required: false)
if clangtidy.found()
run_target(
'tidy',
command: [
'build/tooling/clang-tidy/clang-tidy.sh',
# Checks
'-*,cppcoreguidelines-*,modernize-*,performance-*,portability-*,readability-*,' +
'-readability-inconsistent-declaration-parameter-name,' +
# Header Filter
'.*',
#Finish with files
] + libmemory_lint_files)
endif