1project( 2 'post-code-manager', 3 'cpp', 4 default_options: ['cpp_std=c++23', 'warning_level=3', 'werror=true'], 5 license: 'Apache-2.0', 6 meson_version: '>=1.1.1', 7 version: '1.0', 8) 9 10# Disable JSON implicit conversions. 11add_project_arguments('-DJSON_USE_IMPLICIT_CONVERSIONS=0', language: 'cpp') 12 13conf_data = configuration_data() 14conf_data.set_quoted( 15 'DBUS_OBJECT_NAME', 16 '/xyz/openbmc_project/State/Boot/PostCode', 17) 18conf_data.set_quoted('DBUS_INTF_NAME', 'xyz.openbmc_project.State.Boot.PostCode') 19conf_data.set_quoted( 20 'POSTCODE_DISPLAY_PATH', 21 get_option('postcode-display-path'), 22) 23conf_data.set('MAX_BOOT_CYCLE_COUNT', get_option('max-boot-cycle-count')) 24conf_data.set( 25 'MAX_POST_CODE_SIZE_PER_CYCLE', 26 get_option('max-post-code-size-per-cycle'), 27) 28 29if get_option('bios-post-code-log').allowed() 30 add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG', language: 'cpp') 31endif 32 33configure_file(output: 'config.h', configuration: conf_data) 34 35sdbusplus = dependency('sdbusplus') 36phosphor_logging = dependency('phosphor-logging') 37phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') 38json = dependency('nlohmann_json', include_type: 'system') 39 40cxx = meson.get_compiler('cpp') 41cereal_dep = dependency('cereal', required: false) 42has_cereal = cxx.has_header_symbol( 43 'cereal/cereal.hpp', 44 'cereal::specialize', 45 dependencies: cereal_dep, 46 required: false, 47) 48if not has_cereal 49 cereal_opts = import('cmake').subproject_options() 50 cereal_opts.add_cmake_defines( 51 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}, 52 ) 53 cereal_proj = import('cmake').subproject( 54 'cereal', 55 options: cereal_opts, 56 required: false, 57 ) 58 assert(cereal_proj.found(), 'cereal is required') 59 cereal_dep = cereal_proj.dependency('cereal') 60endif 61 62systemd_system_unit_dir = dependency('systemd').get_variable( 63 'systemd_system_unit_dir', 64) 65 66install_subdir( 67 'service_files', 68 install_dir: systemd_system_unit_dir, 69 strip_directory: true, 70) 71 72packagedir = join_paths( 73 get_option('prefix'), 74 get_option('datadir'), 75 'phosphor-post-code-manager', 76) 77 78install_data(sources: 'post-code-handlers.json', install_dir: packagedir) 79 80executable( 81 'post-code-manager', 82 'src/main.cpp', 83 'src/post_code.cpp', 84 install: true, 85 dependencies: [ 86 sdbusplus, 87 phosphor_dbus_interfaces, 88 phosphor_logging, 89 cereal_dep, 90 json, 91 ], 92 include_directories: 'inc', 93) 94