blob: c4b16c84ca9325a59afcf012592df31c52e649a9 [file] [log] [blame]
Kun Yi0d14a592020-04-06 14:01:36 -07001project(
Patrick Williams13d9ae32025-02-01 08:37:05 -05002 'phosphor-host-postd',
3 'cpp',
4 default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++23'],
5 license: 'Apache-2.0',
6 version: '1.0',
7 meson_version: '>=1.1.1',
Kun Yi0d14a592020-04-06 14:01:36 -07008)
9
10build_tests = get_option('tests')
11
12postd_headers = include_directories('.')
13
14phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
15sdbusplus = dependency('sdbusplus')
16sdeventplus = dependency('sdeventplus')
17systemd = dependency('systemd')
Kumar Thangavel0269eaf2021-08-11 15:45:18 +053018libgpiodcxx = dependency('libgpiodcxx')
Kun Yi0d14a592020-04-06 14:01:36 -070019
20conf_data = configuration_data()
21conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
Kun Yi0d14a592020-04-06 14:01:36 -070022conf_data.set('SYSTEMD_TARGET', get_option('systemd-target'))
23
Jonathan Domande7a6dd2023-05-03 10:54:08 -070024snoopd_src = ['main.cpp']
25snoopd_args = ''
Patrick Williams676fd832023-11-29 06:44:23 -060026if get_option('snoop').allowed()
Patrick Williams13d9ae32025-02-01 08:37:05 -050027 snoopd_src += 'ipmisnoop/ipmisnoop.cpp'
28 add_project_arguments('-DENABLE_IPMI_SNOOP', language: 'cpp')
29 snoopd_args += ' -h "' + get_option('host-instances') + '"'
Jonathan Domande7a6dd2023-05-03 10:54:08 -070030elif get_option('snoop-device') != ''
Patrick Williams13d9ae32025-02-01 08:37:05 -050031 snoopd_args += '-b ' + get_option('post-code-bytes').to_string()
32 snoopd_args += ' -d /dev/' + get_option('snoop-device')
33 rate_limit = get_option('rate-limit')
34 if rate_limit > 0
35 snoopd_args += ' --rate-limit=' + rate_limit.to_string()
36 endif
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053037endif
Jonathan Doman38b09462023-04-26 11:45:39 -070038
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053039conf_data.set('SNOOPD_ARGS', snoopd_args)
40
Kun Yi0d14a592020-04-06 14:01:36 -070041configure_file(
Patrick Williams13d9ae32025-02-01 08:37:05 -050042 input: 'lpcsnoop.service.in',
43 output: 'lpcsnoop.service',
44 configuration: conf_data,
45 install: true,
46 install_dir: systemd.get_variable('systemdsystemunitdir'),
Kun Yi0d14a592020-04-06 14:01:36 -070047)
48
49executable(
Patrick Williams13d9ae32025-02-01 08:37:05 -050050 'snoopd',
51 snoopd_src,
52 dependencies: [
53 sdbusplus,
54 sdeventplus,
55 phosphor_dbus_interfaces,
56 libgpiodcxx,
57 ],
58 install: true,
59)
60
61executable(
62 'snooper',
63 'example.cpp',
64 dependencies: [sdbusplus, sdeventplus, phosphor_dbus_interfaces],
65 install: true,
Kun Yi0d14a592020-04-06 14:01:36 -070066)
67
Patrick Williams9acd8cd2025-01-30 17:47:41 -050068if get_option('7seg').allowed()
Patrick Williams13d9ae32025-02-01 08:37:05 -050069 udevdir = dependency('udev', required: false).get_variable('udevdir')
70 assert(udevdir != '', 'Cannot find udevdir')
71 install_data(['80-7seg.rules'], install_dir: udevdir)
Kun Yi0d14a592020-04-06 14:01:36 -070072
Patrick Williams13d9ae32025-02-01 08:37:05 -050073 install_data(
74 ['postcode-7seg@.service'],
75 install_dir: systemd.get_variable('systemdsystemunitdir'),
76 )
Kun Yi0d14a592020-04-06 14:01:36 -070077
Patrick Williams13d9ae32025-02-01 08:37:05 -050078 executable(
79 'postcode_7seg',
80 '7seg.cpp',
81 dependencies: [sdbusplus, phosphor_dbus_interfaces],
82 install: true,
83 )
Kun Yi0d14a592020-04-06 14:01:36 -070084endif
85
86install_headers(
Patrick Williams13d9ae32025-02-01 08:37:05 -050087 'lpcsnoop/snoop.hpp',
88 'lpcsnoop/snoop_listen.hpp',
89 subdir: 'lpcsnoop',
90)
Kun Yi0d14a592020-04-06 14:01:36 -070091
Patrick Williams9acd8cd2025-01-30 17:47:41 -050092if build_tests.allowed()
Patrick Williams13d9ae32025-02-01 08:37:05 -050093 subdir('test')
Kun Yi0d14a592020-04-06 14:01:36 -070094endif