blob: 7d24758e6ab7e02b863f89da8411db6e4df70be9 [file] [log] [blame] [edit]
project(
'post-code-manager',
'cpp',
default_options: ['cpp_std=c++23', 'warning_level=3', 'werror=true'],
license: 'Apache-2.0',
meson_version: '>=1.1.1',
version: '1.0',
)
# Disable JSON implicit conversions.
add_project_arguments('-DJSON_USE_IMPLICIT_CONVERSIONS=0', language: 'cpp')
conf_data = configuration_data()
conf_data.set_quoted(
'DBUS_OBJECT_NAME',
'/xyz/openbmc_project/State/Boot/PostCode',
)
conf_data.set_quoted('DBUS_INTF_NAME', 'xyz.openbmc_project.State.Boot.PostCode')
conf_data.set_quoted(
'POSTCODE_DISPLAY_PATH',
get_option('postcode-display-path'),
)
conf_data.set('MAX_BOOT_CYCLE_COUNT', get_option('max-boot-cycle-count'))
conf_data.set(
'MAX_POST_CODE_SIZE_PER_CYCLE',
get_option('max-post-code-size-per-cycle'),
)
if get_option('bios-post-code-log').allowed()
add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG', language: 'cpp')
endif
configure_file(output: 'config.h', configuration: conf_data)
sdbusplus = dependency('sdbusplus')
phosphor_logging = dependency('phosphor-logging')
phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
json = dependency('nlohmann_json', include_type: 'system')
cxx = meson.get_compiler('cpp')
cereal_dep = dependency('cereal', required: false)
has_cereal = cxx.has_header_symbol(
'cereal/cereal.hpp',
'cereal::specialize',
dependencies: cereal_dep,
required: false,
)
if not has_cereal
cereal_opts = import('cmake').subproject_options()
cereal_opts.add_cmake_defines(
{'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
)
cereal_proj = import('cmake').subproject(
'cereal',
options: cereal_opts,
required: false,
)
assert(cereal_proj.found(), 'cereal is required')
cereal_dep = cereal_proj.dependency('cereal')
endif
systemd_system_unit_dir = dependency('systemd').get_variable(
'systemd_system_unit_dir',
)
install_subdir(
'service_files',
install_dir: systemd_system_unit_dir,
strip_directory: true,
)
packagedir = join_paths(
get_option('prefix'),
get_option('datadir'),
'phosphor-post-code-manager',
)
configurations = ['post-code-handlers.json']
config_validator = files('scripts/schema_validator.py')
confchecker_iface = custom_target(
'check_syntax_iface',
command: [
'python3',
config_validator,
'--schema',
files('schema/handlers.json'),
'@INPUT@',
],
input: files(configurations),
depend_files: files(configurations),
build_by_default: true,
capture: true,
output: 'validate_configs.log',
)
install_data(sources: configurations, install_dir: packagedir)
executable(
'post-code-manager',
'src/main.cpp',
'src/post_code.cpp',
install: true,
dependencies: [
sdbusplus,
phosphor_dbus_interfaces,
phosphor_logging,
cereal_dep,
json,
],
include_directories: 'inc',
)