Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 1 | project( |
| 2 | 'post-code-manager', |
| 3 | 'cpp', |
| 4 | default_options: [ |
Patrick Williams | 5c75dd5 | 2023-07-12 11:15:27 -0500 | [diff] [blame] | 5 | 'cpp_std=c++23', |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 6 | 'warning_level=3', |
| 7 | 'werror=true', |
| 8 | ], |
| 9 | license: 'Apache-2.0', |
Patrick Williams | 5c75dd5 | 2023-07-12 11:15:27 -0500 | [diff] [blame] | 10 | meson_version: '>=1.1.1', |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 11 | version: '1.0', |
| 12 | ) |
| 13 | |
| 14 | |
| 15 | conf_data = configuration_data() |
Kumar Thangavel | 4e08156 | 2022-12-01 12:56:07 +0530 | [diff] [blame] | 16 | conf_data.set_quoted('DBUS_OBJECT_NAME', '/xyz/openbmc_project/State/Boot/PostCode') |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 17 | conf_data.set_quoted('DBUS_INTF_NAME','xyz.openbmc_project.State.Boot.PostCode') |
Delphine CC Chiu | a4c19b0 | 2023-03-01 13:15:45 +0800 | [diff] [blame] | 18 | conf_data.set_quoted('POSTCODE_DISPLAY_PATH', get_option('postcode-display-path')) |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 19 | conf_data.set('MAX_BOOT_CYCLE_COUNT',get_option('max-boot-cycle-count')) |
Bonnie Lo | c181937 | 2022-10-27 17:14:55 +0800 | [diff] [blame] | 20 | conf_data.set('MAX_POST_CODE_SIZE_PER_CYCLE',get_option('max-post-code-size-per-cycle')) |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 21 | |
Patrick Williams | 8eb4d58 | 2023-11-29 06:44:22 -0600 | [diff] [blame] | 22 | if get_option('bios-post-code-log').allowed() |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 23 | add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp') |
| 24 | endif |
| 25 | |
| 26 | configure_file(output: 'config.h', |
| 27 | configuration: conf_data |
| 28 | ) |
| 29 | |
Patrick Williams | e709874 | 2022-03-21 10:01:23 -0500 | [diff] [blame] | 30 | sdbusplus = dependency('sdbusplus') |
| 31 | phosphor_logging = dependency('phosphor-logging') |
| 32 | phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 33 | |
| 34 | cxx = meson.get_compiler('cpp') |
| 35 | cereal_dep = dependency('cereal', required: false) |
| 36 | has_cereal = cxx.has_header_symbol( |
| 37 | 'cereal/cereal.hpp', |
| 38 | 'cereal::specialize', |
| 39 | dependencies: cereal_dep, |
| 40 | required: false) |
| 41 | if not has_cereal |
| 42 | cereal_opts = import('cmake').subproject_options() |
Konstantin Aladyshev | f2da78d | 2024-04-02 18:14:08 +0300 | [diff] [blame] | 43 | cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}) |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 44 | cereal_proj = import('cmake').subproject( |
| 45 | 'cereal', |
| 46 | options: cereal_opts, |
| 47 | required: false) |
| 48 | assert(cereal_proj.found(), 'cereal is required') |
| 49 | cereal_dep = cereal_proj.dependency('cereal') |
| 50 | endif |
| 51 | |
| 52 | systemd_system_unit_dir = dependency('systemd').get_variable( |
Patrick Williams | 65a6654 | 2023-04-12 08:01:04 -0500 | [diff] [blame] | 53 | 'systemdsystemunitdir') |
Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame] | 54 | |
| 55 | install_subdir('service_files', |
| 56 | install_dir : systemd_system_unit_dir, |
| 57 | strip_directory : true) |
| 58 | |
| 59 | executable( |
| 60 | 'post-code-manager', |
| 61 | 'src/main.cpp', |
| 62 | 'src/post_code.cpp', |
| 63 | install: true, |
| 64 | dependencies: [ |
| 65 | sdbusplus, |
| 66 | phosphor_dbus_interfaces, |
| 67 | phosphor_logging, |
| 68 | cereal_dep], |
| 69 | include_directories: 'inc') |