Ed Tanous | 9b322cb | 2023-07-26 10:42:51 -0700 | [diff] [blame] | 1 | project( |
| 2 | '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 | ] |
| 13 | ) |
| 14 | |
| 15 | bindir = get_option('prefix') + '/' + get_option('bindir') |
| 16 | localstatedir = get_option('localstatedir') |
| 17 | sysconfdir = get_option('sysconfdir') |
| 18 | |
| 19 | c = meson.get_compiler('c') |
| 20 | |
| 21 | json_c = dependency('json-c', include_type: 'system') |
| 22 | udev = c.find_library('udev') |
| 23 | |
| 24 | conf_data = configuration_data() |
| 25 | |
| 26 | if c.has_header_symbol('fcntl.h', 'splice', args: '-D_GNU_SOURCE') |
| 27 | conf_data.set('HAVE_SPLICE', 1) |
| 28 | endif |
| 29 | |
| 30 | conf_data.set('RUNSTATEDIR', '"' + localstatedir + '/run"') |
| 31 | conf_data.set('SYSCONFDIR', '"' + sysconfdir + '"') |
| 32 | |
| 33 | conf_h_dep = declare_dependency( |
| 34 | sources: configure_file( |
| 35 | output: 'config.h', |
| 36 | configuration: conf_data |
| 37 | ) |
| 38 | ) |
| 39 | |
| 40 | add_project_arguments([ |
| 41 | '-Wno-pedantic', |
| 42 | ], language : 'c') |
| 43 | |
| 44 | executable( |
| 45 | 'nbd-proxy', |
| 46 | 'nbd-proxy.c', |
| 47 | dependencies: [ |
| 48 | json_c, |
| 49 | conf_h_dep, |
| 50 | udev, |
| 51 | ], |
| 52 | install: true, |
| 53 | install_dir: bindir |
| 54 | ) |