-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmeson.build
More file actions
171 lines (156 loc) · 5.25 KB
/
meson.build
File metadata and controls
171 lines (156 loc) · 5.25 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
project('csh',
['c', 'cpp'],
subproject_dir: 'lib',
default_options: [
'buildtype=debug',
'optimization=2',
'warning_level=0',
'c_std=gnu11',
'b_lto=false',
'default_library=static',
'slash:builtins=true',
'csp:packet_padding_bytes=42',
'csp:buffer_count=1000',
'csp:buffer_size=2048',
'csp:conn_max=20',
'csp:conn_rxqueue_len=1000',
'csp:qfifo_len=1000',
'csp:rdp_max_window=1000',
'csp:port_max_bind=16',
'csp:use_rtable=true',
'param:have_fopen=true',
'param:have_timestamp=true',
'param:collector=false',
'param:list_dynamic=true'
],
meson_version: '>= 1.6',
version: run_command('git', 'describe', '--long', '--always', '--dirty', check: true).stdout().strip()
)
# Adding -Wall and -Wextra generate harmless (or senseless if you ask me) Meson warnings:
# 'Consider using the built-in warning_level option instead of using "-Wall"'
# 'Consider using the built-in warning_level option instead of using "-Wextra"'
# which would be fine *IF* doing so didn't automatically propagate these options to this project's dependencies.
# As we would like (at least for now) to only care about the warnings in this project's source code,
# we don't want to propagate our warning settings to them, these dependencies can use whatever warning settings
# they want.
# As Meson doesn't propagate the arguments in add_project_arguments() to the dependencies, we can
# accept the Meson warnings given the flexibilty we gain
add_project_arguments(['-Wall', '-Wextra', '-Wstrict-prototypes', '-Wmissing-prototypes', '-Wno-unused-parameter'], language: 'c')
# add_project_arguments(['-fanalyzer'], language: 'c')
curl_dep = dependency(
'libcurl',
not_found_message: 'libcurl not found! Please install libcurl4-openssl-dev or the appropriate package for your system.'
)
zmq_dep = dependency(
'libzmq',
not_found_message: 'libzmq not found! Please install libzmq3-dev or the appropriate package for your system.'
)
csp_dep = dependency('csp', fallback: ['csp', 'csp_dep'], required: true).as_link_whole()
slash_dep = dependency('slash', fallback: ['slash', 'slash_dep'], required: true).as_link_whole()
param_dep = dependency('param', fallback: ['param', 'param_dep'], required: true).as_link_whole()
ossi_dep = dependency('ossi', version: ['>=0.0.2'],fallback: ['ossi', 'ossi_dep'], required: true).as_link_whole()
apm_api_dep = dependency(
'apm_csh',
fallback:
[
'apm_csh',
'apm_csh_dep'
],
required: true).partial_dependency(
links: false,
includes: true
)
csh_sources = [
'src/main.c',
'src/slash_apm.c',
'src/slash_csp.c',
'src/slash_eth.c',
'src/slash_hooks.c',
'src/csp_debug_param.c',
'src/base16.c',
'src/param_sniffer.c',
'src/prometheus.c',
'src/resbuf_dump.c',
'src/stdbuf_client.c',
'src/csp_scan.c',
'src/sleep_slash.c',
'src/spaceboot_slash.c',
'src/nav.c',
'src/serial.c',
'src/hk_param_sniffer.c',
'src/lock.c',
'src/csp_init_cmd.c',
'src/vts.c',
'src/walkdir.c',
'src/victoria_metrics.c',
'src/loki.c',
'src/slash_env_var_cmds.c',
'src/slash_nodes_cmds.c',
'src/slash_run_environment.c',
'src/require_version_cmd.c',
'src/param_list_slash.c',
'src/param_slash.c',
'src/vmem_client_slash.c',
'src/vmem_client_slash_ftp.c',
]
python_dep = dependency('python3', version : '>=3.10', required: false)
if python_dep.found()
py = import('python').find_installation('python3')
python_ldflags = run_command('python'+py.language_version()+'-config', '--ldflags', '--embed', check: true).stdout().strip().split()
add_project_arguments('-DHAVE_PYTHON', language: 'c')
pycsh_dep = dependency('pycsh_core', fallback: ['pycsh_core', 'pycsh_core_dep']).as_link_whole()
csh_sources += [
'src/python/python_loader.c'
]
else
python_ldflags = []
pycsh_dep = []
endif
csh_sources += vcs_tag(input: files('src/version.c.in'), output: 'version.c', command: ['git', 'describe', '--always', '--dirty=+'])
utils_lib_src = [
'src/url_utils.c',
'src/environment.c',
'src/require_version.c',
'src/csh_defaults.c',
'src/slash_utils.c',
'src/known_hosts.c'
]
utils_lib_inc = include_directories('src')
utils_lib = static_library('csh_utils', utils_lib_src, include_directories: utils_lib_inc, dependencies: [apm_api_dep])
utils_lib_dep = declare_dependency(
include_directories: utils_lib_inc,
link_with: utils_lib,
dependencies: [apm_api_dep]
)
if meson.is_subproject() == false
subdir('tests')
endif
csh = executable('csh', csh_sources,
dependencies : [
python_dep,
apm_api_dep,
slash_dep,
param_dep,
ossi_dep,
csp_dep,
curl_dep,
utils_lib_dep.as_link_whole(),
pycsh_dep
],
include_directories: include_directories('include'),
# Posix Message Queues (see libossi) are accessible through the "rt" library, so add it
link_args : python_ldflags + ['-Wl,-Map=csh.map', '-lm', '-Wl,--export-dynamic', '-ldl', '-lrt'],
install : true,
)
custom_target('size', output: ['dummy.txt'], command: [find_program('size'), csh.full_path()], depends: csh, build_by_default: true)
zmqproxy_sources = ['src/zmqproxy.c']
zmqproxy = executable('zmqproxy', zmqproxy_sources,
dependencies : [csp_dep, zmq_dep],
install : true,
)
spacebridge_sources = ['src/spacebridge.c']
spacebridge = executable('spacebridge', spacebridge_sources,
dependencies : [csp_dep],
install : true,
)
install_data('init/caninit', install_dir : get_option('bindir'))