-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmeson.build
118 lines (105 loc) · 2.74 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
project(
'mutest', 'c',
version: '2019.1',
default_options: [
'buildtype=debugoptimized',
'c_std=c99',
'warning_level=2',
],
license: 'MIT',
meson_version: '>= 0.50.1',
)
add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c')
mutest_version = meson.project_version().split('.')
mutest_major = mutest_version[0].to_int()
mutest_minor = mutest_version[1].to_int()
mutest_api_version = 1
mutest_soversion = '@0@.@1@.@2@'.format(0, mutest_major, mutest_minor)
mutest_prefix = get_option('prefix')
mutest_libdir = mutest_prefix / get_option('libdir')
mutest_datadir = mutest_prefix / get_option('datadir')
mutest_includedir = mutest_prefix / get_option('includedir')
mutest_libexecdir = mutest_prefix / get_option('libexecdir')
mutest_api_path = '@0@-@1@'.format(meson.project_name(), mutest_api_version)
cc = meson.get_compiler('c')
host_system = host_machine.system()
if cc.get_id() == 'msvc'
test_cflags = [
'-we4002',
'-we4003',
'-w14010',
'-we4013',
'-w14016',
'-we4020',
'-we4021',
'-we4027',
'-we4029',
'-we4033',
'-we4035',
'-we4045',
'-we4047',
'-we4049',
'-we4053',
'-we4071',
'-we4150',
'-we4819',
'-utf-8',
]
else
test_cflags = [
'-fstrict-aliasing',
'-Wcast-align',
'-Wignored-qualifiers',
'-Wimplicit-function-declaration',
'-Wlogical-op',
'-Wmissing-format-attribute',
'-Wmissing-noreturn',
'-Wmissing-include-dirs',
'-Wnested-externs',
'-Wold-style-definition',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wstrict-prototypes',
'-Wswitch-enum',
'-Wuninitialized',
'-Wunused',
'-Werror=address',
'-Werror=array-bounds',
'-Werror=empty-body',
'-Werror=format=2',
'-Werror=implicit',
'-Werror=init-self',
'-Werror=main',
'-Werror=missing-braces',
'-Werror=missing-declarations',
'-Werror=missing-prototypes',
'-Werror=nonnull',
'-Werror=pointer-to-int-cast',
'-Werror=return-type',
'-Werror=sequence-point',
'-Werror=trigraphs',
'-Werror=undef',
'-Werror=vla',
'-Werror=write-strings',
]
endif
common_flags = cc.get_supported_arguments(test_cflags)
config_h = configuration_data()
# Detect and set symbol visibility
if get_option('default_library') != 'static'
if host_system == 'windows'
config_h.set('DLL_EXPORT', true)
config_h.set('MUTEST_PUBLIC', '__declspec(dllexport) extern')
else
config_h.set('MUTEST_PUBLIC', '__attribute__((visibility("default"))) extern')
endif
endif
if get_option('debug')
add_project_arguments([ '-DMUTEST_ENABLE_DEBUG' ], language: 'c')
endif
static = get_option('static')
installable = not (static and meson.is_subproject())
subdir('include')
subdir('src')
subdir('tests')