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')
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')
36endif
37conf_data.set('SNOOPD_ARGS', snoopd_args)
38
39configure_file(
40  input: 'lpcsnoop.service.in',
41  output: 'lpcsnoop.service',
42  configuration: conf_data,
43  install: true,
44  install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir'))
45
46executable(
47  'snoopd',
48  'main.cpp',
49  dependencies: [
50    sdbusplus,
51    sdeventplus,
52    phosphor_dbus_interfaces,
53    libgpiodcxx,
54  ],
55  install: true,
56)
57
58executable(
59  'snooper',
60  'example.cpp',
61  dependencies: [
62    sdbusplus,
63    sdeventplus,
64    phosphor_dbus_interfaces,
65  ],
66  install: true,
67)
68
69if get_option('7seg').enabled()
70  udevdir = dependency('udev', required : false).get_pkgconfig_variable('udevdir')
71  assert(udevdir != '', 'Cannot find udevdir')
72  install_data(['80-7seg.rules'], install_dir : udevdir)
73
74  install_data(
75    ['postcode-7seg@.service'],
76    install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir')
77  )
78
79  executable(
80    'postcode_7seg',
81    '7seg.cpp',
82    dependencies: [
83      sdbusplus,
84      phosphor_dbus_interfaces,
85    ],
86    install: true,
87  )
88endif
89
90install_headers(
91  'lpcsnoop/snoop.hpp',
92  'lpcsnoop/snoop_listen.hpp',
93  subdir: 'lpcsnoop')
94
95if not build_tests.disabled()
96  subdir('test')
97endif
98