xref: /openbmc/phosphor-post-code-manager/meson.build (revision 608a392189d48ff0f0b94d2f21d9dd7a99323872)
1project(
2    'post-code-manager',
3    'cpp',
4    default_options: [
5        'cpp_std=c++23',
6        'warning_level=3',
7        'werror=true',
8    ],
9    license: 'Apache-2.0',
10    meson_version: '>=1.1.1',
11    version: '1.0',
12)
13
14
15conf_data = configuration_data()
16conf_data.set_quoted('DBUS_OBJECT_NAME', '/xyz/openbmc_project/State/Boot/PostCode')
17conf_data.set_quoted('DBUS_INTF_NAME','xyz.openbmc_project.State.Boot.PostCode')
18conf_data.set_quoted('POSTCODE_DISPLAY_PATH', get_option('postcode-display-path'))
19conf_data.set('MAX_BOOT_CYCLE_COUNT',get_option('max-boot-cycle-count'))
20conf_data.set('MAX_POST_CODE_SIZE_PER_CYCLE',get_option('max-post-code-size-per-cycle'))
21
22if get_option('bios-post-code-log').enabled()
23  add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp')
24endif
25
26configure_file(output: 'config.h',
27  configuration: conf_data
28)
29
30sdbusplus = dependency('sdbusplus')
31phosphor_logging = dependency('phosphor-logging')
32phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
33
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(
53          'systemdsystemunitdir')
54
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')
70