Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 1 | project( |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 2 | '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 Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 8 | ) |
| 9 | |
| 10 | build_tests = get_option('tests') |
| 11 | |
| 12 | postd_headers = include_directories('.') |
| 13 | |
| 14 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
| 15 | sdbusplus = dependency('sdbusplus') |
| 16 | sdeventplus = dependency('sdeventplus') |
| 17 | systemd = dependency('systemd') |
Kumar Thangavel | 0269eaf | 2021-08-11 15:45:18 +0530 | [diff] [blame] | 18 | libgpiodcxx = dependency('libgpiodcxx') |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 19 | |
| 20 | conf_data = configuration_data() |
| 21 | conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 22 | conf_data.set('SYSTEMD_TARGET', get_option('systemd-target')) |
| 23 | |
Jonathan Doman | de7a6dd | 2023-05-03 10:54:08 -0700 | [diff] [blame] | 24 | snoopd_src = ['main.cpp'] |
| 25 | snoopd_args = '' |
Patrick Williams | 676fd83 | 2023-11-29 06:44:23 -0600 | [diff] [blame] | 26 | if get_option('snoop').allowed() |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 27 | snoopd_src += 'ipmisnoop/ipmisnoop.cpp' |
| 28 | add_project_arguments('-DENABLE_IPMI_SNOOP', language: 'cpp') |
| 29 | snoopd_args += ' -h "' + get_option('host-instances') + '"' |
Jonathan Doman | de7a6dd | 2023-05-03 10:54:08 -0700 | [diff] [blame] | 30 | elif get_option('snoop-device') != '' |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 31 | 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 Eda | aade4ad | 2021-02-19 11:20:33 +0530 | [diff] [blame] | 37 | endif |
Jonathan Doman | 38b0946 | 2023-04-26 11:45:39 -0700 | [diff] [blame] | 38 | |
Manojkiran Eda | aade4ad | 2021-02-19 11:20:33 +0530 | [diff] [blame] | 39 | conf_data.set('SNOOPD_ARGS', snoopd_args) |
| 40 | |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 41 | configure_file( |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 42 | input: 'lpcsnoop.service.in', |
| 43 | output: 'lpcsnoop.service', |
| 44 | configuration: conf_data, |
| 45 | install: true, |
| 46 | install_dir: systemd.get_variable('systemdsystemunitdir'), |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 47 | ) |
| 48 | |
| 49 | executable( |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 50 | 'snoopd', |
| 51 | snoopd_src, |
| 52 | dependencies: [ |
| 53 | sdbusplus, |
| 54 | sdeventplus, |
| 55 | phosphor_dbus_interfaces, |
| 56 | libgpiodcxx, |
| 57 | ], |
| 58 | install: true, |
| 59 | ) |
| 60 | |
| 61 | executable( |
| 62 | 'snooper', |
| 63 | 'example.cpp', |
| 64 | dependencies: [sdbusplus, sdeventplus, phosphor_dbus_interfaces], |
| 65 | install: true, |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 66 | ) |
| 67 | |
Patrick Williams | 9acd8cd | 2025-01-30 17:47:41 -0500 | [diff] [blame] | 68 | if get_option('7seg').allowed() |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 69 | udevdir = dependency('udev', required: false).get_variable('udevdir') |
| 70 | assert(udevdir != '', 'Cannot find udevdir') |
| 71 | install_data(['80-7seg.rules'], install_dir: udevdir) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 72 | |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 73 | install_data( |
| 74 | ['postcode-7seg@.service'], |
| 75 | install_dir: systemd.get_variable('systemdsystemunitdir'), |
| 76 | ) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 77 | |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 78 | executable( |
| 79 | 'postcode_7seg', |
| 80 | '7seg.cpp', |
| 81 | dependencies: [sdbusplus, phosphor_dbus_interfaces], |
| 82 | install: true, |
| 83 | ) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 84 | endif |
| 85 | |
| 86 | install_headers( |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 87 | 'lpcsnoop/snoop.hpp', |
| 88 | 'lpcsnoop/snoop_listen.hpp', |
| 89 | subdir: 'lpcsnoop', |
| 90 | ) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 91 | |
Patrick Williams | 9acd8cd | 2025-01-30 17:47:41 -0500 | [diff] [blame] | 92 | if build_tests.allowed() |
Patrick Williams | 13d9ae3 | 2025-02-01 08:37:05 -0500 | [diff] [blame] | 93 | subdir('test') |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 94 | endif |