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