blob: 715045cd9ee2dc01393ac60859b2544e145faa1e [file] [log] [blame]
Kun Yi0d14a592020-04-06 14:01:36 -07001project(
2 'phosphor-host-postd',
3 'cpp',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
Patrick Williams42c2b562023-07-12 11:15:29 -05007 'cpp_std=c++23'
Kun Yi0d14a592020-04-06 14:01:36 -07008 ],
9 license: 'Apache-2.0',
10 version: '1.0',
Patrick Williams42c2b562023-07-12 11:15:29 -050011 meson_version: '>=1.1.1',
Kun Yi0d14a592020-04-06 14:01:36 -070012)
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')
Kumar Thangavel0269eaf2021-08-11 15:45:18 +053022libgpiodcxx = dependency('libgpiodcxx')
Kun Yi0d14a592020-04-06 14:01:36 -070023
24conf_data = configuration_data()
25conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
Kun Yi0d14a592020-04-06 14:01:36 -070026conf_data.set('SYSTEMD_TARGET', get_option('systemd-target'))
27
Jonathan Domande7a6dd2023-05-03 10:54:08 -070028snoopd_src = ['main.cpp']
29snoopd_args = ''
Patrick Williams676fd832023-11-29 06:44:23 -060030if get_option('snoop').allowed()
Jonathan Domande7a6dd2023-05-03 10:54:08 -070031 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()
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053036 snoopd_args += ' -d /dev/' + get_option('snoop-device')
Jonathan Doman38b09462023-04-26 11:45:39 -070037 rate_limit = get_option('rate-limit')
38 if rate_limit > 0
39 snoopd_args += ' --rate-limit=' + rate_limit.to_string()
40 endif
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053041endif
Jonathan Doman38b09462023-04-26 11:45:39 -070042
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053043conf_data.set('SNOOPD_ARGS', snoopd_args)
44
Kun Yi0d14a592020-04-06 14:01:36 -070045configure_file(
46 input: 'lpcsnoop.service.in',
47 output: 'lpcsnoop.service',
48 configuration: conf_data,
49 install: true,
Patrick Williams65d17532023-04-12 08:01:11 -050050 install_dir: systemd.get_variable('systemdsystemunitdir'))
Kun Yi0d14a592020-04-06 14:01:36 -070051
52executable(
53 'snoopd',
Jonathan Domande7a6dd2023-05-03 10:54:08 -070054 snoopd_src,
Kun Yi0d14a592020-04-06 14:01:36 -070055 dependencies: [
56 sdbusplus,
57 sdeventplus,
58 phosphor_dbus_interfaces,
Kumar Thangavel0269eaf2021-08-11 15:45:18 +053059 libgpiodcxx,
Kun Yi0d14a592020-04-06 14:01:36 -070060 ],
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
Willy Tu5efea6a2022-07-11 16:15:29 -070075if not get_option('7seg').disabled()
Patrick Williams65d17532023-04-12 08:01:11 -050076 udevdir = dependency('udev', required : false).get_variable('udevdir')
Kun Yi0d14a592020-04-06 14:01:36 -070077 assert(udevdir != '', 'Cannot find udevdir')
78 install_data(['80-7seg.rules'], install_dir : udevdir)
79
80 install_data(
81 ['postcode-7seg@.service'],
Patrick Williams65d17532023-04-12 08:01:11 -050082 install_dir: systemd.get_variable('systemdsystemunitdir')
Kun Yi0d14a592020-04-06 14:01:36 -070083 )
84
85 executable(
86 'postcode_7seg',
87 '7seg.cpp',
88 dependencies: [
89 sdbusplus,
90 phosphor_dbus_interfaces,
91 ],
Kun Yi0d14a592020-04-06 14:01:36 -070092 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