George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-ledmanager', 'cpp', |
| 3 | version : '1.0.0', |
Patrick Williams | 959b482 | 2023-07-12 11:15:13 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
Patrick Williams | 959b482 | 2023-07-12 11:15:13 -0500 | [diff] [blame] | 8 | 'cpp_std=c++23', |
George Liu | db6d763 | 2021-12-27 14:11:01 +0800 | [diff] [blame] | 9 | 'buildtype=debugoptimized', |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 10 | ] |
| 11 | ) |
| 12 | |
Patrick Williams | 6fc3562 | 2023-12-07 17:10:47 -0600 | [diff] [blame] | 13 | cpp = meson.get_compiler('cpp') |
| 14 | |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 15 | conf_data = configuration_data() |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 16 | conf_data.set_quoted('SAVED_GROUPS_FILE', '/var/lib/phosphor-led-manager/savedGroups') |
| 17 | conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout') |
| 18 | conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault') |
| 19 | conf_data.set_quoted('ELOG_ENTRY', 'entry') |
| 20 | conf_data.set_quoted('LED_FAULT', 'fault') |
| 21 | |
| 22 | conf_data.set('CLASS_VERSION', 1) |
Patrick Williams | 95b0db9 | 2023-11-29 06:43:59 -0600 | [diff] [blame] | 23 | conf_data.set('LED_USE_JSON', get_option('use-json').allowed()) |
| 24 | conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').allowed()) |
| 25 | conf_data.set('MONITOR_OPERATIONAL_STATUS', get_option('monitor-operational-status').allowed()) |
| 26 | conf_data.set('PERSISTENT_LED_ASSERTED', get_option('persistent-led-asserted').allowed()) |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 27 | |
Patrick Williams | 6fc3562 | 2023-12-07 17:10:47 -0600 | [diff] [blame] | 28 | nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') |
Patrick Williams | a821dea | 2022-03-21 09:43:07 -0500 | [diff] [blame] | 29 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 30 | phosphor_logging_dep = dependency('phosphor-logging') |
Patrick Williams | 6fc3562 | 2023-12-07 17:10:47 -0600 | [diff] [blame] | 31 | sdbusplus_dep = dependency('sdbusplus') |
| 32 | sdeventplus_dep = dependency('sdeventplus') |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 33 | |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 34 | prog_python = find_program('python3', required: true) |
| 35 | realpath_prog = find_program('realpath') |
| 36 | |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 37 | |
Patrick Williams | 7217c03 | 2022-03-16 16:26:09 -0500 | [diff] [blame] | 38 | if cpp.has_header('CLI/CLI.hpp') |
| 39 | CLI11_dep = declare_dependency() |
| 40 | else |
Patrick Williams | a821dea | 2022-03-21 09:43:07 -0500 | [diff] [blame] | 41 | CLI11_dep = dependency('CLI11') |
Patrick Williams | 7217c03 | 2022-03-16 16:26:09 -0500 | [diff] [blame] | 42 | endif |
| 43 | |
Patrick Williams | d1c1f0e | 2022-03-16 10:46:47 -0500 | [diff] [blame] | 44 | # Get Cereal dependency. |
| 45 | cereal_dep = dependency('cereal', required: false) |
| 46 | has_cereal = cpp.has_header_symbol( |
| 47 | 'cereal/cereal.hpp', |
| 48 | 'cereal::specialize', |
| 49 | dependencies: cereal_dep, |
| 50 | required: false) |
| 51 | if not has_cereal |
| 52 | cereal_opts = import('cmake').subproject_options() |
| 53 | cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'}) |
| 54 | cereal_proj = import('cmake').subproject( |
| 55 | 'cereal', |
| 56 | options: cereal_opts, |
| 57 | required: false) |
| 58 | assert(cereal_proj.found(), 'cereal is required') |
| 59 | cereal_dep = cereal_proj.dependency('cereal') |
| 60 | endif |
| 61 | |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 62 | deps = [ |
Patrick Williams | 7217c03 | 2022-03-16 16:26:09 -0500 | [diff] [blame] | 63 | CLI11_dep, |
| 64 | cereal_dep, |
| 65 | nlohmann_json_dep, |
| 66 | phosphor_dbus_interfaces_dep, |
| 67 | phosphor_logging_dep, |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 68 | sdbusplus_dep, |
George Liu | 687fe07 | 2021-05-04 16:16:43 +0800 | [diff] [blame] | 69 | sdeventplus_dep, |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 70 | ] |
| 71 | |
Patrick Williams | 953315d | 2022-03-16 14:30:39 -0500 | [diff] [blame] | 72 | subdir('manager') |
| 73 | subdir('fault-monitor') |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 74 | |
| 75 | configure_file(output: 'config.h', |
| 76 | configuration: conf_data |
| 77 | ) |
| 78 | |
| 79 | install_data( |
| 80 | 'scripts/led-set-all-groups-asserted.sh', |
| 81 | install_dir: get_option('bindir') |
| 82 | ) |
| 83 | |
George Liu | 049700c | 2023-08-07 17:28:30 +0800 | [diff] [blame] | 84 | if get_option('tests').allowed() |
George Liu | 4b06201 | 2020-10-13 15:26:58 +0800 | [diff] [blame] | 85 | subdir('test') |
| 86 | endif |
George Liu | 629f4a3 | 2021-04-14 17:42:08 +0800 | [diff] [blame] | 87 | |
| 88 | install_subdir('configs', |
| 89 | install_dir: get_option('datadir') / 'phosphor-led-manager', |
| 90 | strip_directory: true) |