-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
52 lines (46 loc) · 1.14 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
project('narg', 'c',
default_options : ['c_std=c99', 'warning_level=3'],
license : 'MPL 2.0'
)
version = '1.0.0'
narg_sources = [
'api/findopt.c',
'api/printopt.c',
'api/utf8len.c',
]
unittests = narg_sources + [
'inc/assign_params.c',
'inc/reverse_slices.c',
'inc/str.c',
'inc/wordcount.c',
'testapi/testability.c',
]
if meson.is_subproject()
narg = static_library('narg', sources : narg_sources)
narg_dep = declare_dependency(
link_with: narg,
include_directories: include_directories('api')
)
else
narg = library('narg', sources : narg_sources, install : true, version : version)
install_headers('api/narg.h')
pkg_mod = import('pkgconfig')
pkg_mod.generate(
libraries : narg,
version : version,
name : 'libnarg',
filebase : 'narg',
description : 'A commandline option parser library.'
)
endif
testapi = static_library('testability', sources : ['testapi/testability.c'])
foreach u : unittests
dir = u.split('/').get(0)
name = 'test_' + u.split('/').get(1).split('.').get(0)
libs = [ testapi ]
if dir == 'api'
libs += [narg]
endif
exe = executable(name, u, c_args : '-DTEST', link_with : libs)
test(name, exe)
endforeach