-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
79 lines (68 loc) · 1.71 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
project('libyconfig', 'c',
version : '0.0.1',
default_options : [
'warning_level=3',
'werror=true',
'c_std=c99',
],
license : 'MIT',
meson_version: '>= 0.49',
)
cc = meson.get_compiler('c')
flags = [
'-Wshadow',
'-Wstrict-prototypes',
'-Wmissing-prototypes',
'-Wno-padded',
]
add_project_arguments(cc.get_supported_arguments(flags), language : 'c')
libyaml = cc.find_library('libyaml', required : true)
# follow semantic versionning (https://semver.org)
major = '0' # incompatible API changes
minor = '0' # add backwards-compatible functionality
patch = '1' # backwards-compatible bug fixes
version = major + '.' + minor + '.' + patch
sources = files(
'src/common.h',
'src/yconfig.c',
'src/yconfig.h',
)
install_headers('src/yconfig.h')
libyconfig = shared_library('yconfig',
sources,
version : version,
install : true,
include_directories : include_directories('src'),
dependencies : [libyaml],
)
#
# TESTS
#
all_tests_sources = []
if get_option('tests')
smoketest_files = files('tests/smoketest.c', 'tests/check.h')
smoketest = executable('smoketest',
'tests/smoketest.c',
include_directories : include_directories('src', 'tests'),
link_with : libyconfig,
dependencies : [libyaml],
)
all_tests_sources += smoketest_files
test('smoketest',
smoketest,
args : ['tests/config.yaml'],
)
endif # tests
#
# DEVTOOLS
#
codespell = find_program('codespell', required : false)
if codespell.found()
run_target('spelling',
command : [
codespell,
sources,
all_tests_sources,
]
)
endif # codespell