-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
257 lines (218 loc) · 6.99 KB
/
meson.build
File metadata and controls
257 lines (218 loc) · 6.99 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# global project def
project('alibc.containers', 'c')
# ========= INSTALLATION CONTROL =========
# Install compiled libraries?
should_install_libs = false
if get_option('install_libs') == 'not_subproject'
should_install_libs = not meson.is_subproject()
else
should_install_libs = (get_option('install_libs') == 'yes')
endif
# Install headers?
should_install_headers = false
if get_option('install_headers') == 'not_subproject'
should_install_headers = not meson.is_subproject()
else
should_install_headers = (get_option('install_headers') == 'yes')
endif
# ========= END INSTALLATION CONTROL =========
# ========= BUILDING CONTROL =========
# Build tests?
should_build_tests = false
if get_option('build_tests') == 'yes'
should_build_tests = true
elif get_option('build_tests') == 'not_subproject'
should_build_tests = not meson.is_subproject()
endif
# ========= END BUILDING CONTROL =========
# ========= VERSION CONTROL INFO TAGGING ========
vcs_info = vcs_tag(
command: ['git', 'rev-parse', 'HEAD'],
input: 'templates/lib/vcs_info.template.c',
output: 'vcs_info.c',
fallback: 'NOTFOUND'
)
# ========= END VERSION CONTROL INFO TAGGING ========
# ========= PROJECT VARIABLES =========
# Properties of the C compiler
cc = meson.get_compiler('c')
if get_option('buildtype') == 'debug'
# enable alibc debug functions and debugging symbols.
add_project_arguments('-DDEBUG=1', '-ggdb3', language: 'c')
endif
# headers
includes = include_directories('include')
# ========= END PROJECT VARIABLES =========
# ========= LIBRARY BUILD TARGETS =========
sl_dynabuf = library(
'alc_dynabuf', ['lib/dynabuf.c', vcs_info],
include_directories: includes,
install: should_install_libs
)
sl_array = library(
'alc_array', ['lib/array.c', vcs_info],
include_directories: includes,
link_with: sl_dynabuf,
install: should_install_libs
)
sl_bitmap = library(
'alc_bitmap', ['lib/bitmap.c', vcs_info],
include_directories: includes,
link_with: sl_dynabuf,
install: should_install_libs
)
sl_hashmap = library(
'alc_hashmap', ['lib/hashmap.c', vcs_info],
include_directories: includes,
link_with: [sl_dynabuf, sl_bitmap],
install: should_install_libs
)
sl_hash_functions = library(
'alc_hash_functions',
['lib/hash_functions.c', vcs_info],
include_directories: includes,
install: should_install_libs
)
sl_comparators = library(
'alc_comparators',
['lib/comparators.c', vcs_info],
include_directories: includes,
install: should_install_libs
)
sl_set = library(
'alc_set', ['lib/set.c', vcs_info],
include_directories: includes,
link_with: [sl_bitmap, sl_dynabuf],
install: should_install_libs
)
sl_iterator = library(
'alc_iter', ['lib/iterator.c', vcs_info],
include_directories: includes,
install: should_install_libs
)
sl_array_iter = library(
'alc_array_iter', ['lib/array_iterator.c', vcs_info],
include_directories: includes,
link_with: [sl_iterator, sl_array],
install: should_install_libs
)
sl_hashmap_iter = library(
'alc_hashmap_iter', ['lib/hashmap_iterator.c', vcs_info],
include_directories: includes,
link_with: [sl_iterator, sl_hashmap, sl_bitmap, sl_dynabuf],
install: should_install_libs
)
sl_set_iter = library(
'alc_set_iter', ['lib/set_iterator.c', vcs_info],
include_directories: includes,
link_with: [sl_iterator, sl_set, sl_bitmap, sl_dynabuf],
install: should_install_libs
)
# ========= END LIBRARY BUILD TARGETS =========
# ========= DEPENDENCY OBJECTS FOR SUPERPROJECT BUILDS =========
dep_dynabuf = declare_dependency(
include_directories: includes,
link_with: sl_dynabuf
)
dep_array = declare_dependency(
include_directories: includes,
link_with: [sl_array, sl_dynabuf]
)
dep_bitmap = declare_dependency(
include_directories: includes,
link_with: [sl_bitmap, sl_dynabuf]
)
dep_hashmap = declare_dependency(
include_directories: includes,
link_with: [sl_hashmap, sl_bitmap, sl_dynabuf]
)
dep_hash_functions = declare_dependency(
include_directories: includes,
link_with: sl_hash_functions
)
dep_comparators = declare_dependency(
include_directories: includes,
link_with: sl_comparators
)
dep_set = declare_dependency(
include_directories: includes,
link_with: [sl_set, sl_bitmap, sl_dynabuf]
)
dep_iterator = declare_dependency(
include_directories: includes,
link_with: [sl_iterator]
)
dep_array_iter = declare_dependency(
include_directories: includes,
link_with: [sl_iterator, sl_array, sl_array_iter]
)
dep_hashmap_iter = declare_dependency(
include_directories: includes,
link_with: [sl_iterator, sl_hashmap, sl_bitmap, sl_hashmap_iter, sl_dynabuf]
)
dep_set_iter = declare_dependency(
include_directories: includes,
link_with: [sl_iterator, sl_set, sl_bitmap, sl_set_iter, sl_dynabuf]
)
# ========= END DEPENDENCY OBJECTS FOR SUPERPROJECT BUILDS =========
# ========= UNIT TEST BUILD TARGETS =========
ext_cmocka = dependency('cmocka', required: false)
if ext_cmocka.found() and should_build_tests
exe_dynabuf_test = executable(
'test_dynabuf', 'tests/test_dynabuf.c',
include_directories: includes,
link_with: [sl_dynabuf],
dependencies: ext_cmocka
)
exe_array_test = executable(
'test_array', 'tests/test_array.c',
include_directories: includes,
link_with: [sl_dynabuf, sl_array, sl_iterator, sl_array_iter],
dependencies: ext_cmocka
)
exe_bitmap_test = executable(
'test_bitmap', 'tests/test_bitmap.c',
include_directories: includes,
link_with: sl_bitmap, dependencies: ext_cmocka
)
exe_set_test = executable(
'test_set', 'tests/test_set.c',
link_with: [
sl_set, sl_hash_functions, sl_comparators, sl_iterator, sl_set_iter
],
include_directories: includes,
dependencies: ext_cmocka
)
exe_hashmap_test = executable(
'test_hashmap', 'tests/test_hashmap.c',
include_directories: includes,
link_with: [
sl_hashmap, sl_hash_functions, sl_comparators,
sl_iterator, sl_hashmap_iter,
sl_bitmap, sl_dynabuf, sl_bitmap
],
dependencies: ext_cmocka
)
exe_comparators_test = executable(
'test_default_comparators', 'tests/test_default_comparators.c',
include_directories: includes,
link_with: [sl_comparators],
dependencies: ext_cmocka
)
# test run targets
test('test_dynabuf', exe_dynabuf_test)
test('test_array', exe_array_test)
test('test_bitmap', exe_bitmap_test)
test('test_set', exe_set_test)
test('test_hashmap', exe_hashmap_test)
test('test_default_comparators', exe_comparators_test)
endif
# ========= END UNIT TEST BUILD TARGETS =========
# ========= HEADER INSTALLATION CONFIG =========
if should_install_headers
install_subdir(
get_option('includedir'),
strip_directory: true,
install_dir: join_paths(get_option('prefix'), 'include')
)
endif