blob: 8573539feffe1df670a9f7e1ffb785edb179b8b8 [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 Williamsec799a52021-10-06 15:36:20 -05007 'cpp_std=c++20'
Kun Yi0d14a592020-04-06 14:01:36 -07008 ],
9 license: 'Apache-2.0',
10 version: '1.0',
Patrick Williams65d17532023-04-12 08:01:11 -050011 meson_version: '>=0.58.0',
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
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053028snoopd_args = '-b ' + get_option('post-code-bytes').to_string()
Kumar Thangavel0269eaf2021-08-11 15:45:18 +053029if not get_option('snoop').disabled()
30 add_project_arguments('-DENABLE_IPMI_SNOOP',language:'cpp')
31 snoopd_args += ' -h "' + get_option('host-instances') + '"'
32endif
33
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053034if get_option('snoop-device') != ''
35 snoopd_args += ' -d /dev/' + get_option('snoop-device')
Jonathan Doman38b09462023-04-26 11:45:39 -070036 rate_limit = get_option('rate-limit')
37 if rate_limit > 0
38 snoopd_args += ' --rate-limit=' + rate_limit.to_string()
39 endif
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053040endif
Jonathan Doman38b09462023-04-26 11:45:39 -070041
Manojkiran Edaaade4ad2021-02-19 11:20:33 +053042conf_data.set('SNOOPD_ARGS', snoopd_args)
43
Kun Yi0d14a592020-04-06 14:01:36 -070044configure_file(
45 input: 'lpcsnoop.service.in',
46 output: 'lpcsnoop.service',
47 configuration: conf_data,
48 install: true,
Patrick Williams65d17532023-04-12 08:01:11 -050049 install_dir: systemd.get_variable('systemdsystemunitdir'))
Kun Yi0d14a592020-04-06 14:01:36 -070050
51executable(
52 'snoopd',
53 'main.cpp',
54 dependencies: [
55 sdbusplus,
56 sdeventplus,
57 phosphor_dbus_interfaces,
Kumar Thangavel0269eaf2021-08-11 15:45:18 +053058 libgpiodcxx,
Kun Yi0d14a592020-04-06 14:01:36 -070059 ],
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
Willy Tu5efea6a2022-07-11 16:15:29 -070074if not get_option('7seg').disabled()
Patrick Williams65d17532023-04-12 08:01:11 -050075 udevdir = dependency('udev', required : false).get_variable('udevdir')
Kun Yi0d14a592020-04-06 14:01:36 -070076 assert(udevdir != '', 'Cannot find udevdir')
77 install_data(['80-7seg.rules'], install_dir : udevdir)
78
79 install_data(
80 ['postcode-7seg@.service'],
Patrick Williams65d17532023-04-12 08:01:11 -050081 install_dir: systemd.get_variable('systemdsystemunitdir')
Kun Yi0d14a592020-04-06 14:01:36 -070082 )
83
84 executable(
85 'postcode_7seg',
86 '7seg.cpp',
87 dependencies: [
88 sdbusplus,
89 phosphor_dbus_interfaces,
90 ],
Kun Yi0d14a592020-04-06 14:01:36 -070091 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