xref: /openbmc/phosphor-post-code-manager/meson.build (revision d4430278581a501ebaa80a7c6084867529224b0f)
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
11conf_data = configuration_data()
12conf_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)
26
27if get_option('bios-post-code-log').allowed()
28    add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG', language: 'cpp')
29endif
30
31configure_file(output: 'config.h', configuration: conf_data)
32
33sdbusplus = dependency('sdbusplus')
34phosphor_logging = dependency('phosphor-logging')
35phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
36
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,
43    required: false,
44)
45if not has_cereal
46    cereal_opts = import('cmake').subproject_options()
47    cereal_opts.add_cmake_defines(
48        {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
49    )
50    cereal_proj = import('cmake').subproject(
51        'cereal',
52        options: cereal_opts,
53        required: false,
54    )
55    assert(cereal_proj.found(), 'cereal is required')
56    cereal_dep = cereal_proj.dependency('cereal')
57endif
58
59systemd_system_unit_dir = dependency('systemd').get_variable(
60    'systemdsystemunitdir',
61)
62
63install_subdir(
64    'service_files',
65    install_dir: systemd_system_unit_dir,
66    strip_directory: true,
67)
68
69executable(
70    'post-code-manager',
71    'src/main.cpp',
72    'src/post_code.cpp',
73    install: true,
74    dependencies: [
75        sdbusplus,
76        phosphor_dbus_interfaces,
77        phosphor_logging,
78        cereal_dep,
79    ],
80    include_directories: 'inc',
81)
82