1project(
2  'phosphor-host-postd',
3  'cpp',
4  default_options: [
5    'warning_level=3',
6    'werror=true',
7    'cpp_std=c++20'
8  ],
9  license: 'Apache-2.0',
10  version: '1.0',
11  meson_version: '>=0.57.0',
12)
13
14build_tests = get_option('tests')
15
16postd_headers = include_directories('.')
17
18phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
19sdbusplus = dependency('sdbusplus')
20sdeventplus = dependency('sdeventplus')
21systemd = dependency('systemd')
22
23conf_data = configuration_data()
24conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
25conf_data.set('SYSTEMD_TARGET', get_option('systemd-target'))
26
27snoopd_args = '-b ' + get_option('post-code-bytes').to_string()
28if get_option('snoop-device') != ''
29  snoopd_args += ' -d /dev/' + get_option('snoop-device')
30endif
31conf_data.set('SNOOPD_ARGS', snoopd_args)
32
33configure_file(
34  input: 'lpcsnoop.service.in',
35  output: 'lpcsnoop.service',
36  configuration: conf_data,
37  install: true,
38  install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir'))
39
40executable(
41  'snoopd',
42  'main.cpp',
43  dependencies: [
44    sdbusplus,
45    sdeventplus,
46    phosphor_dbus_interfaces,
47  ],
48  install: true,
49)
50
51executable(
52  'snooper',
53  'example.cpp',
54  dependencies: [
55    sdbusplus,
56    sdeventplus,
57    phosphor_dbus_interfaces,
58  ],
59  install: true,
60)
61
62if get_option('7seg').enabled()
63  udevdir = dependency('udev', required : false).get_pkgconfig_variable('udevdir')
64  assert(udevdir != '', 'Cannot find udevdir')
65  install_data(['80-7seg.rules'], install_dir : udevdir)
66
67  install_data(
68    ['postcode-7seg@.service'],
69    install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir')
70  )
71
72  executable(
73    'postcode_7seg',
74    '7seg.cpp',
75    dependencies: [
76      sdbusplus,
77      phosphor_dbus_interfaces,
78    ],
79    link_args : [
80      '-lstdc++fs',
81    ],
82    install: true,
83  )
84endif
85
86install_headers(
87  'lpcsnoop/snoop.hpp',
88  'lpcsnoop/snoop_listen.hpp',
89  subdir: 'lpcsnoop')
90
91if not build_tests.disabled()
92  subdir('test')
93endif
94