blob: dd0261241d1811bbddde3dd155488450419153f5 [file] [log] [blame]
Manojkiran Eda84855ab2021-12-05 11:09:02 +05301project(
2 'post-code-manager',
3 'cpp',
4 default_options: [
Patrick Williams5c75dd52023-07-12 11:15:27 -05005 'cpp_std=c++23',
Manojkiran Eda84855ab2021-12-05 11:09:02 +05306 'warning_level=3',
7 'werror=true',
8 ],
9 license: 'Apache-2.0',
Patrick Williams5c75dd52023-07-12 11:15:27 -050010 meson_version: '>=1.1.1',
Manojkiran Eda84855ab2021-12-05 11:09:02 +053011 version: '1.0',
12)
13
14
15conf_data = configuration_data()
Kumar Thangavel4e081562022-12-01 12:56:07 +053016conf_data.set_quoted('DBUS_OBJECT_NAME', '/xyz/openbmc_project/State/Boot/PostCode')
Manojkiran Eda84855ab2021-12-05 11:09:02 +053017conf_data.set_quoted('DBUS_INTF_NAME','xyz.openbmc_project.State.Boot.PostCode')
Delphine CC Chiua4c19b02023-03-01 13:15:45 +080018conf_data.set_quoted('POSTCODE_DISPLAY_PATH', get_option('postcode-display-path'))
Manojkiran Eda84855ab2021-12-05 11:09:02 +053019conf_data.set('MAX_BOOT_CYCLE_COUNT',get_option('max-boot-cycle-count'))
Bonnie Loc1819372022-10-27 17:14:55 +080020conf_data.set('MAX_POST_CODE_SIZE_PER_CYCLE',get_option('max-post-code-size-per-cycle'))
Manojkiran Eda84855ab2021-12-05 11:09:02 +053021
Patrick Williams8eb4d582023-11-29 06:44:22 -060022if get_option('bios-post-code-log').allowed()
Manojkiran Eda84855ab2021-12-05 11:09:02 +053023 add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp')
24endif
25
26configure_file(output: 'config.h',
27 configuration: conf_data
28)
29
Patrick Williamse7098742022-03-21 10:01:23 -050030sdbusplus = dependency('sdbusplus')
31phosphor_logging = dependency('phosphor-logging')
32phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
Manojkiran Eda84855ab2021-12-05 11:09:02 +053033
34cxx = meson.get_compiler('cpp')
35cereal_dep = dependency('cereal', required: false)
36has_cereal = cxx.has_header_symbol(
37 'cereal/cereal.hpp',
38 'cereal::specialize',
39 dependencies: cereal_dep,
40 required: false)
41if not has_cereal
42 cereal_opts = import('cmake').subproject_options()
43 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
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')
50endif
51
52systemd_system_unit_dir = dependency('systemd').get_variable(
Patrick Williams65a66542023-04-12 08:01:04 -050053 'systemdsystemunitdir')
Manojkiran Eda84855ab2021-12-05 11:09:02 +053054
55install_subdir('service_files',
56 install_dir : systemd_system_unit_dir,
57 strip_directory : true)
58
59executable(
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')