blob: c7e9e162cf3e046297e31f54cfe84d643f40df73 [file] [log] [blame]
Manojkiran Eda84855ab2021-12-05 11:09:02 +05301project(
2 'post-code-manager',
3 'cpp',
Patrick Williamsd4430272025-02-01 08:36:58 -05004 default_options: ['cpp_std=c++23', 'warning_level=3', 'werror=true'],
Manojkiran Eda84855ab2021-12-05 11:09:02 +05305 license: 'Apache-2.0',
Patrick Williams5c75dd52023-07-12 11:15:27 -05006 meson_version: '>=1.1.1',
Manojkiran Eda84855ab2021-12-05 11:09:02 +05307 version: '1.0',
8)
9
10
11conf_data = configuration_data()
Patrick Williamsd4430272025-02-01 08:36:58 -050012conf_data.set_quoted(
13 'DBUS_OBJECT_NAME',
14 '/xyz/openbmc_project/State/Boot/PostCode',
15)
16conf_data.set_quoted('DBUS_INTF_NAME', 'xyz.openbmc_project.State.Boot.PostCode')
17conf_data.set_quoted(
18 'POSTCODE_DISPLAY_PATH',
19 get_option('postcode-display-path'),
20)
21conf_data.set('MAX_BOOT_CYCLE_COUNT', get_option('max-boot-cycle-count'))
22conf_data.set(
23 'MAX_POST_CODE_SIZE_PER_CYCLE',
24 get_option('max-post-code-size-per-cycle'),
25)
Manojkiran Eda84855ab2021-12-05 11:09:02 +053026
Patrick Williams8eb4d582023-11-29 06:44:22 -060027if get_option('bios-post-code-log').allowed()
Patrick Williamsd4430272025-02-01 08:36:58 -050028 add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG', language: 'cpp')
Manojkiran Eda84855ab2021-12-05 11:09:02 +053029endif
30
Patrick Williamsd4430272025-02-01 08:36:58 -050031configure_file(output: 'config.h', configuration: conf_data)
Manojkiran Eda84855ab2021-12-05 11:09:02 +053032
Patrick Williamse7098742022-03-21 10:01:23 -050033sdbusplus = dependency('sdbusplus')
34phosphor_logging = dependency('phosphor-logging')
35phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
Manojkiran Eda84855ab2021-12-05 11:09:02 +053036
37cxx = meson.get_compiler('cpp')
38cereal_dep = dependency('cereal', required: false)
39has_cereal = cxx.has_header_symbol(
40 'cereal/cereal.hpp',
41 'cereal::specialize',
42 dependencies: cereal_dep,
Patrick Williamsd4430272025-02-01 08:36:58 -050043 required: false,
44)
Manojkiran Eda84855ab2021-12-05 11:09:02 +053045if not has_cereal
46 cereal_opts = import('cmake').subproject_options()
Patrick Williamsd4430272025-02-01 08:36:58 -050047 cereal_opts.add_cmake_defines(
48 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
49 )
Manojkiran Eda84855ab2021-12-05 11:09:02 +053050 cereal_proj = import('cmake').subproject(
51 'cereal',
52 options: cereal_opts,
Patrick Williamsd4430272025-02-01 08:36:58 -050053 required: false,
54 )
Manojkiran Eda84855ab2021-12-05 11:09:02 +053055 assert(cereal_proj.found(), 'cereal is required')
56 cereal_dep = cereal_proj.dependency('cereal')
57endif
58
59systemd_system_unit_dir = dependency('systemd').get_variable(
Patrick Williamsd4430272025-02-01 08:36:58 -050060 'systemdsystemunitdir',
61)
Manojkiran Eda84855ab2021-12-05 11:09:02 +053062
Patrick Williamsd4430272025-02-01 08:36:58 -050063install_subdir(
64 'service_files',
65 install_dir: systemd_system_unit_dir,
66 strip_directory: true,
67)
Manojkiran Eda84855ab2021-12-05 11:09:02 +053068
69executable(
70 'post-code-manager',
71 'src/main.cpp',
72 'src/post_code.cpp',
73 install: true,
74 dependencies: [
Patrick Williamsd4430272025-02-01 08:36:58 -050075 sdbusplus,
76 phosphor_dbus_interfaces,
77 phosphor_logging,
78 cereal_dep,
79 ],
80 include_directories: 'inc',
81)