Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-host-postd', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'warning_level=3', |
| 6 | 'werror=true', |
Patrick Williams | 42c2b56 | 2023-07-12 11:15:29 -0500 | [diff] [blame] | 7 | 'cpp_std=c++23' |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | version: '1.0', |
Patrick Williams | 42c2b56 | 2023-07-12 11:15:29 -0500 | [diff] [blame] | 11 | meson_version: '>=1.1.1', |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 12 | ) |
| 13 | |
| 14 | build_tests = get_option('tests') |
| 15 | |
| 16 | postd_headers = include_directories('.') |
| 17 | |
| 18 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
| 19 | sdbusplus = dependency('sdbusplus') |
| 20 | sdeventplus = dependency('sdeventplus') |
| 21 | systemd = dependency('systemd') |
Kumar Thangavel | 0269eaf | 2021-08-11 15:45:18 +0530 | [diff] [blame] | 22 | libgpiodcxx = dependency('libgpiodcxx') |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 23 | |
| 24 | conf_data = configuration_data() |
| 25 | conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 26 | conf_data.set('SYSTEMD_TARGET', get_option('systemd-target')) |
| 27 | |
Jonathan Doman | de7a6dd | 2023-05-03 10:54:08 -0700 | [diff] [blame] | 28 | snoopd_src = ['main.cpp'] |
| 29 | snoopd_args = '' |
Patrick Williams | 676fd83 | 2023-11-29 06:44:23 -0600 | [diff] [blame] | 30 | if get_option('snoop').allowed() |
Jonathan Doman | de7a6dd | 2023-05-03 10:54:08 -0700 | [diff] [blame] | 31 | snoopd_src += 'ipmisnoop/ipmisnoop.cpp' |
| 32 | add_project_arguments('-DENABLE_IPMI_SNOOP',language:'cpp') |
| 33 | snoopd_args += ' -h "' + get_option('host-instances') + '"' |
| 34 | elif get_option('snoop-device') != '' |
| 35 | snoopd_args += '-b ' + get_option('post-code-bytes').to_string() |
Manojkiran Eda | aade4ad | 2021-02-19 11:20:33 +0530 | [diff] [blame] | 36 | snoopd_args += ' -d /dev/' + get_option('snoop-device') |
Jonathan Doman | 38b0946 | 2023-04-26 11:45:39 -0700 | [diff] [blame] | 37 | rate_limit = get_option('rate-limit') |
| 38 | if rate_limit > 0 |
| 39 | snoopd_args += ' --rate-limit=' + rate_limit.to_string() |
| 40 | endif |
Manojkiran Eda | aade4ad | 2021-02-19 11:20:33 +0530 | [diff] [blame] | 41 | endif |
Jonathan Doman | 38b0946 | 2023-04-26 11:45:39 -0700 | [diff] [blame] | 42 | |
Manojkiran Eda | aade4ad | 2021-02-19 11:20:33 +0530 | [diff] [blame] | 43 | conf_data.set('SNOOPD_ARGS', snoopd_args) |
| 44 | |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 45 | configure_file( |
| 46 | input: 'lpcsnoop.service.in', |
| 47 | output: 'lpcsnoop.service', |
| 48 | configuration: conf_data, |
| 49 | install: true, |
Patrick Williams | 65d1753 | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 50 | install_dir: systemd.get_variable('systemdsystemunitdir')) |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 51 | |
| 52 | executable( |
| 53 | 'snoopd', |
Jonathan Doman | de7a6dd | 2023-05-03 10:54:08 -0700 | [diff] [blame] | 54 | snoopd_src, |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 55 | dependencies: [ |
| 56 | sdbusplus, |
| 57 | sdeventplus, |
| 58 | phosphor_dbus_interfaces, |
Kumar Thangavel | 0269eaf | 2021-08-11 15:45:18 +0530 | [diff] [blame] | 59 | libgpiodcxx, |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 60 | ], |
| 61 | install: true, |
| 62 | ) |
| 63 | |
| 64 | executable( |
| 65 | 'snooper', |
| 66 | 'example.cpp', |
| 67 | dependencies: [ |
| 68 | sdbusplus, |
| 69 | sdeventplus, |
| 70 | phosphor_dbus_interfaces, |
| 71 | ], |
| 72 | install: true, |
| 73 | ) |
| 74 | |
Willy Tu | 5efea6a | 2022-07-11 16:15:29 -0700 | [diff] [blame] | 75 | if not get_option('7seg').disabled() |
Patrick Williams | 65d1753 | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 76 | udevdir = dependency('udev', required : false).get_variable('udevdir') |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 77 | assert(udevdir != '', 'Cannot find udevdir') |
| 78 | install_data(['80-7seg.rules'], install_dir : udevdir) |
| 79 | |
| 80 | install_data( |
| 81 | ['postcode-7seg@.service'], |
Patrick Williams | 65d1753 | 2023-04-12 08:01:11 -0500 | [diff] [blame] | 82 | install_dir: systemd.get_variable('systemdsystemunitdir') |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 83 | ) |
| 84 | |
| 85 | executable( |
| 86 | 'postcode_7seg', |
| 87 | '7seg.cpp', |
| 88 | dependencies: [ |
| 89 | sdbusplus, |
| 90 | phosphor_dbus_interfaces, |
| 91 | ], |
Kun Yi | 0d14a59 | 2020-04-06 14:01:36 -0700 | [diff] [blame] | 92 | install: true, |
| 93 | ) |
| 94 | endif |
| 95 | |
| 96 | install_headers( |
| 97 | 'lpcsnoop/snoop.hpp', |
| 98 | 'lpcsnoop/snoop_listen.hpp', |
| 99 | subdir: 'lpcsnoop') |
| 100 | |
| 101 | if not build_tests.disabled() |
| 102 | subdir('test') |
| 103 | endif |