blob: ff9cb9cbb56bd774144ada1df2c8e2b163d210e6 [file] [log] [blame]
Ed Tanous9b322cb2023-07-26 10:42:51 -07001project(
Patrick Williams493883c2025-02-01 08:38:14 -05002 'jsnbd',
3 'c',
4 version: '1.0',
5 meson_version: '>=0.63.0',
6 default_options: [
7 'b_ndebug=if-release',
8 'cpp_rtti=false',
9 'cpp_std=c++20',
10 'warning_level=3',
11 'werror=true',
12 ],
Ed Tanous9b322cb2023-07-26 10:42:51 -070013)
14
15bindir = get_option('prefix') + '/' + get_option('bindir')
16localstatedir = get_option('localstatedir')
17sysconfdir = get_option('sysconfdir')
18
19c = meson.get_compiler('c')
20
21json_c = dependency('json-c', include_type: 'system')
22udev = c.find_library('udev')
23
24conf_data = configuration_data()
25
26if c.has_header_symbol('fcntl.h', 'splice', args: '-D_GNU_SOURCE')
Patrick Williams493883c2025-02-01 08:38:14 -050027 conf_data.set('HAVE_SPLICE', 1)
Ed Tanous9b322cb2023-07-26 10:42:51 -070028endif
29
30conf_data.set('RUNSTATEDIR', '"' + localstatedir + '/run"')
31conf_data.set('SYSCONFDIR', '"' + sysconfdir + '"')
32
33conf_h_dep = declare_dependency(
Patrick Williams493883c2025-02-01 08:38:14 -050034 sources: configure_file(output: 'config.h', configuration: conf_data),
Ed Tanous9b322cb2023-07-26 10:42:51 -070035)
36
Patrick Williams493883c2025-02-01 08:38:14 -050037add_project_arguments(['-Wno-pedantic'], language: 'c')
Ed Tanous9b322cb2023-07-26 10:42:51 -070038
39executable(
Patrick Williams493883c2025-02-01 08:38:14 -050040 'nbd-proxy',
41 'nbd-proxy.c',
42 dependencies: [json_c, conf_h_dep, udev],
43 install: true,
44 install_dir: bindir,
Ed Tanous9b322cb2023-07-26 10:42:51 -070045)