-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmeson.build
More file actions
122 lines (100 loc) · 3.83 KB
/
meson.build
File metadata and controls
122 lines (100 loc) · 3.83 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
project('param', 'c', subproject_dir:'lib', default_options: ['warning_level=2', 'werror=true'])
add_project_arguments(['-Wstrict-prototypes', '-Wmissing-prototypes', '-Wmissing-declarations', '-Wcast-align', '-Wpointer-arith', '-Wshadow'], language: 'c')
conf = configuration_data()
conf.set('PARAM_HAVE_SYS_QUEUE', get_option('list_dynamic') or get_option('list_pool') > 0)
conf.set('PARAM_LIST_DYNAMIC', get_option('list_dynamic'))
conf.set('PARAM_LIST_POOL', get_option('list_pool'))
conf.set('PARAM_HAVE_TIMESTAMP', get_option('have_timestamp'))
# From now on, VMEM API is 64bits, breaking earlier ABI.
# New user code can use the fact that this macro is defined (its value is not relevant, just the fact that it is defined)
# to check that the libparam version included (typically through convoluted dependency paths) does support the 64-bits API
# and #error if it doesnt.
VMEM_64_BITS_API_description = '''From now on, VMEM API is 64bits, breaking earlier ABI.
New user code can use the fact that this macro is defined (its value is not relevant, just the fact that it is defined)
to check that the libparam version included (typically through convoluted dependency paths) does support the 64-bits API
and #error if it doesnt.'''
conf.set('PARAM_VMEM_64_BITS_API', 1, description: VMEM_64_BITS_API_description)
if get_option('have_float') == false
conf.set('MPACK_FLOAT', 0)
endif
if get_option('have_fopen') == true
if get_option('list_dynamic') == true
conf.set('MPACK_STDIO', 1)
else
warning('*********')
warning('Enabling \'have_fopen\' without also enabling \'list_dynamic\' causes mpack related build failures, setting MPACK_STDIO=0')
warning('*********')
conf.set('MPACK_STDIO', 0)
endif
endif
libparam_h = configure_file(output: 'libparam.h', configuration: conf, install_dir: 'include', install_tag: 'devel')
csp_dep = dependency('csp', fallback : ['csp', 'csp_dep'])
clib = meson.get_compiler('c').find_library('c', required: false)
clib_dep = []
if not clib.found()
clib_dep = dependency('libc', fallback: ['picolibc', 'picolibc_dep'], required: true)
endif
# On linux include bsd libraries for strlcpy function (which is non standard)
bsd_dep = dependency('libbsd-overlay', required: false)
param_src = files([
'src/param/list/param_list.c',
'src/param/param_client.c',
'src/param/param_serializer.c',
'src/param/param_server.c',
'src/param/param_string.c',
'src/param/param_queue.c',
'src/param/param_wildcard.c',
'src/param/param.c',
'src/mpack/mpack.c',
'src/vmem/vmem_client.c',
'src/vmem/vmem_crc32.c',
'src/vmem/vmem_server.c',
'src/vmem/vmem.c',
'src/vmem/vmem_block.c',
])
if get_option('have_fopen') == true
param_src += files([
'src/vmem/vmem_file.c',
'src/vmem/vmem_mmap.c',
])
endif
if get_option('vmem_fram') == true
param_src += files([
'src/vmem/vmem_fram.c',
'src/vmem/vmem_fram_cache.c',
])
endif
if get_option('collector') == true
param_src += files([
'src/param/collector/param_collector_config.c',
'src/param/collector/param_collector.c',
])
endif
param_inc = include_directories('.', 'include')
if get_option('default_library') == 'static'
deps = [clib_dep, bsd_dep, csp_dep.partial_dependency(includes:true)]
else
deps = [clib_dep, bsd_dep, csp_dep]
endif
param_lib = library('param',
sources: [param_src, libparam_h],
include_directories : param_inc,
dependencies : deps,
install : true,
soversion: meson.project_version()
)
install_subdir('include', install_dir : '.', install_tag: 'devel')
pkg = import('pkgconfig')
pkg.generate(
param_lib,
requires: ['csp'],
subdirs : ['.'],
)
param_dep = declare_dependency(include_directories : param_inc, link_with : param_lib, dependencies: [clib_dep, bsd_dep, csp_dep])
if get_option('default_library') == 'static'
param_link_whole_dep = declare_dependency(
include_directories : param_inc,
link_with : param_lib,
link_whole: [param_lib]
)
endif