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.58.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')
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_args = '-b ' + get_option('post-code-bytes').to_string()
29if not get_option('snoop').disabled()
30    add_project_arguments('-DENABLE_IPMI_SNOOP',language:'cpp')
31    snoopd_args += ' -h "' + get_option('host-instances') + '"'
32endif
33
34if get_option('snoop-device') != ''
35  snoopd_args += ' -d /dev/' + get_option('snoop-device')
36  rate_limit = get_option('rate-limit')
37  if rate_limit > 0
38    snoopd_args += ' --rate-limit=' + rate_limit.to_string()
39  endif
40endif
41
42conf_data.set('SNOOPD_ARGS', snoopd_args)
43
44configure_file(
45  input: 'lpcsnoop.service.in',
46  output: 'lpcsnoop.service',
47  configuration: conf_data,
48  install: true,
49  install_dir: systemd.get_variable('systemdsystemunitdir'))
50
51executable(
52  'snoopd',
53  'main.cpp',
54  dependencies: [
55    sdbusplus,
56    sdeventplus,
57    phosphor_dbus_interfaces,
58    libgpiodcxx,
59  ],
60  install: true,
61)
62
63executable(
64  'snooper',
65  'example.cpp',
66  dependencies: [
67    sdbusplus,
68    sdeventplus,
69    phosphor_dbus_interfaces,
70  ],
71  install: true,
72)
73
74if not get_option('7seg').disabled()
75  udevdir = dependency('udev', required : false).get_variable('udevdir')
76  assert(udevdir != '', 'Cannot find udevdir')
77  install_data(['80-7seg.rules'], install_dir : udevdir)
78
79  install_data(
80    ['postcode-7seg@.service'],
81    install_dir: systemd.get_variable('systemdsystemunitdir')
82  )
83
84  executable(
85    'postcode_7seg',
86    '7seg.cpp',
87    dependencies: [
88      sdbusplus,
89      phosphor_dbus_interfaces,
90    ],
91    install: true,
92  )
93endif
94
95install_headers(
96  'lpcsnoop/snoop.hpp',
97  'lpcsnoop/snoop_listen.hpp',
98  subdir: 'lpcsnoop')
99
100if not build_tests.disabled()
101  subdir('test')
102endif
103