-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
79 lines (66 loc) · 1.91 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(
'libmatrix',
['c', 'cpp'],
default_options: [
'buildtype=debugoptimized',
'warning_level=3',
'b_lto=true',
'c_std=c11',
],
)
cc = meson.get_compiler('c')
src = ['src/api.c', 'src/linked_list.c', 'src/matrix.c', 'src/sync.c']
tests = ['test_parsing']
c_args = [
'-D_GNU_SOURCE',
]
warning_c_args = [
'-Wshadow',
'-Wnull-dereference',
'-Wformat=2',
'-Wcast-qual',
'-Wconversion',
'-Wpointer-arith',
'-Wunused-macros',
'-Wredundant-decls',
'-Wwrite-strings',
'-Werror=int-conversion',
'-Werror=implicit-function-declaration',
'-Werror=incompatible-pointer-types',
]
add_project_arguments(c_args, language: 'c')
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
libcurl_dep = dependency('libcurl', required: true, version: '>= 7.68.0')
libcjson_dep = dependency('cjson', required: false, version: '>= 1.7.13')
threads_dep = dependency('threads', required: true)
m_dep = cc.find_library('m', required: false)
if not libcjson_dep.found()
libcjson_proj = subproject(
'cjson',
default_options: ['tests=false', 'default_library=static'],
)
libcjson_dep = libcjson_proj.get_variable('libcjson_dep')
endif
incdir = include_directories('include')
libmatrix = static_library(
'matrix',
src,
dependencies: [libcurl_dep, libcjson_dep, threads_dep, m_dep],
include_directories: incdir,
)
libmatrix_dep = declare_dependency(
include_directories: incdir,
link_with: libmatrix,
)
if get_option('tests')
unity_proj = subproject('unity', default_options: ['werror=false'])
unity_dep = unity_proj.get_variable('unity_dep')
foreach test_name : tests
exe = executable(
test_name,
'tests/@[email protected]'.format(test_name),
dependencies: [libmatrix_dep, unity_dep],
)
test(test_name, exe)
endforeach
endif