1project(
2  'phosphor-host-postd',
3  'cpp',
4  default_options: [
5    'warning_level=3',
6    'werror=true',
7    'cpp_std=c++23'
8  ],
9  license: 'Apache-2.0',
10  version: '1.0',
11  meson_version: '>=1.1.1',
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')
22libgpiodcxx = dependency('libgpiodcxx')
23
24conf_data = configuration_data()
25conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
26conf_data.set('SYSTEMD_TARGET', get_option('systemd-target'))
27
28snoopd_src = ['main.cpp']
29snoopd_args = ''
30if get_option('snoop').allowed()
31  snoopd_src += 'ipmisnoop/ipmisnoop.cpp'
32  add_project_arguments('-DENABLE_IPMI_SNOOP',language:'cpp')
33  snoopd_args += ' -h "' + get_option('host-instances') + '"'
34elif get_option('snoop-device') != ''
35  snoopd_args += '-b ' + get_option('post-code-bytes').to_string()
36  snoopd_args += ' -d /dev/' + get_option('snoop-device')
37  rate_limit = get_option('rate-limit')
38  if rate_limit > 0
39    snoopd_args += ' --rate-limit=' + rate_limit.to_string()
40  endif
41endif
42
43conf_data.set('SNOOPD_ARGS', snoopd_args)
44
45configure_file(
46  input: 'lpcsnoop.service.in',
47  output: 'lpcsnoop.service',
48  configuration: conf_data,
49  install: true,
50  install_dir: systemd.get_variable('systemdsystemunitdir'))
51
52executable(
53  'snoopd',
54  snoopd_src,
55  dependencies: [
56    sdbusplus,
57    sdeventplus,
58    phosphor_dbus_interfaces,
59    libgpiodcxx,
60  ],
61  install: true,
62)
63
64executable(
65  'snooper',
66  'example.cpp',
67  dependencies: [
68    sdbusplus,
69    sdeventplus,
70    phosphor_dbus_interfaces,
71  ],
72  install: true,
73)
74
75if not get_option('7seg').disabled()
76  udevdir = dependency('udev', required : false).get_variable('udevdir')
77  assert(udevdir != '', 'Cannot find udevdir')
78  install_data(['80-7seg.rules'], install_dir : udevdir)
79
80  install_data(
81    ['postcode-7seg@.service'],
82    install_dir: systemd.get_variable('systemdsystemunitdir')
83  )
84
85  executable(
86    'postcode_7seg',
87    '7seg.cpp',
88    dependencies: [
89      sdbusplus,
90      phosphor_dbus_interfaces,
91    ],
92    install: true,
93  )
94endif
95
96install_headers(
97  'lpcsnoop/snoop.hpp',
98  'lpcsnoop/snoop_listen.hpp',
99  subdir: 'lpcsnoop')
100
101if not build_tests.disabled()
102  subdir('test')
103endif
104