-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
45 lines (37 loc) · 1.4 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
project('assertions', 'c',
license: 'Unlicense',
version: '1.0',
default_options : ['c_std=c99'])
compiler = meson.get_compiler('c')
errored = false
checks = [
{'type': 'header', 'name': 'stdlib.h'},
{'type': 'header', 'name': 'stdio.h'},
{'type': 'header', 'name': 'stddef.h'},
{'type': 'header', 'name': 'stdint.h'},
{'type': 'function', 'name': 'fprintf', 'prefix': '#include <stdio.h>'},
{'type': 'function', 'name': 'abort', 'prefix': '#include <stdlib.h>'},
]
foreach check : checks
type = check.get('type')
name = check.get('name')
if type == 'header'
if not compiler.check_header(name)
errored = true
warning('The compiler cannot find the ' + name + ' header. Make sure you have a C standard library installed.')
endif
elif type == 'function'
if not compiler.has_function(name, prefix: check.get('prefix'))
errored = true
warning('The compiler could not find the ' + name + ' function. Make sure you have a C standard library installed.')
endif
endif
endforeach
if errored
error('Cannot continue the build as there are errors with the environment')
endif
assertions_files = files('assertions.h')
install_headers(assertions_files)
assertions_inc = include_directories('.')
assertions_dep = declare_dependency(include_directories: [assertions_inc])
subdir('test')