Manojkiran Eda | 84855ab | 2021-12-05 11:09:02 +0530 | [diff] [blame^] | 1 | project( |
| 2 | 'post-code-manager', |
| 3 | 'cpp', |
| 4 | default_options: [ |
| 5 | 'cpp_std=c++20', |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
| 8 | ], |
| 9 | license: 'Apache-2.0', |
| 10 | meson_version: '>=0.57.0', |
| 11 | version: '1.0', |
| 12 | ) |
| 13 | |
| 14 | |
| 15 | conf_data = configuration_data() |
| 16 | conf_data.set_quoted('DBUS_OBJECT_NAME', '/xyz/openbmc_project/State/Boot/PostCode0') |
| 17 | conf_data.set_quoted('DBUS_INTF_NAME','xyz.openbmc_project.State.Boot.PostCode') |
| 18 | conf_data.set('MAX_BOOT_CYCLE_COUNT',get_option('max-boot-cycle-count')) |
| 19 | |
| 20 | if get_option('bios-post-code-log').enabled() |
| 21 | add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp') |
| 22 | endif |
| 23 | |
| 24 | configure_file(output: 'config.h', |
| 25 | configuration: conf_data |
| 26 | ) |
| 27 | |
| 28 | sdbusplus = dependency( |
| 29 | 'sdbusplus', |
| 30 | fallback: ['sdbusplus', 'sdbusplus_dep'] |
| 31 | ) |
| 32 | |
| 33 | phosphor_logging = dependency( |
| 34 | 'phosphor-logging', |
| 35 | fallback: [ |
| 36 | 'phosphor-logging', |
| 37 | 'phosphor_logging_dep']) |
| 38 | |
| 39 | phosphor_dbus_interfaces = dependency( |
| 40 | 'phosphor-dbus-interfaces', |
| 41 | fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep'] |
| 42 | ) |
| 43 | |
| 44 | cxx = meson.get_compiler('cpp') |
| 45 | cereal_dep = dependency('cereal', required: false) |
| 46 | has_cereal = cxx.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 | |
| 62 | systemd_system_unit_dir = dependency('systemd').get_variable( |
| 63 | pkgconfig: 'systemdsystemunitdir') |
| 64 | |
| 65 | install_subdir('service_files', |
| 66 | install_dir : systemd_system_unit_dir, |
| 67 | strip_directory : true) |
| 68 | |
| 69 | executable( |
| 70 | 'post-code-manager', |
| 71 | 'src/main.cpp', |
| 72 | 'src/post_code.cpp', |
| 73 | install: true, |
| 74 | dependencies: [ |
| 75 | sdbusplus, |
| 76 | phosphor_dbus_interfaces, |
| 77 | phosphor_logging, |
| 78 | cereal_dep], |
| 79 | include_directories: 'inc') |