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