xref: /openbmc/phosphor-post-code-manager/meson.build (revision eddf960a4377a0573f85b69c4fdd886d450f7a25)
1project(
2    'post-code-manager',
3    'cpp',
4    default_options: [
5        'cpp_std=c++20',
6        'warning_level=3',
7        'werror=true',
8    ],
9    license: 'Apache-2.0',
10    meson_version: '>=0.57.0',
11    version: '1.0',
12)
13
14
15conf_data = configuration_data()
16conf_data.set_quoted('DBUS_OBJECT_NAME', '/xyz/openbmc_project/State/Boot/PostCode0')
17conf_data.set_quoted('DBUS_INTF_NAME','xyz.openbmc_project.State.Boot.PostCode')
18conf_data.set('MAX_BOOT_CYCLE_COUNT',get_option('max-boot-cycle-count'))
19conf_data.set('MAX_POST_CODE_SIZE_PER_CYCLE',get_option('max-post-code-size-per-cycle'))
20
21if get_option('bios-post-code-log').enabled()
22  add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp')
23endif
24
25configure_file(output: 'config.h',
26  configuration: conf_data
27)
28
29sdbusplus = dependency('sdbusplus')
30phosphor_logging = dependency('phosphor-logging')
31phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
32
33cxx = meson.get_compiler('cpp')
34cereal_dep = dependency('cereal', required: false)
35has_cereal = cxx.has_header_symbol(
36    'cereal/cereal.hpp',
37    'cereal::specialize',
38    dependencies: cereal_dep,
39    required: false)
40if not has_cereal
41    cereal_opts = import('cmake').subproject_options()
42    cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
43    cereal_proj = import('cmake').subproject(
44        'cereal',
45        options: cereal_opts,
46        required: false)
47    assert(cereal_proj.found(), 'cereal is required')
48    cereal_dep = cereal_proj.dependency('cereal')
49endif
50
51systemd_system_unit_dir = dependency('systemd').get_variable(
52          pkgconfig: 'systemdsystemunitdir')
53
54install_subdir('service_files',
55               install_dir : systemd_system_unit_dir,
56               strip_directory : true)
57
58executable(
59    'post-code-manager',
60    'src/main.cpp',
61    'src/post_code.cpp',
62    install: true,
63    dependencies: [
64      sdbusplus,
65      phosphor_dbus_interfaces,
66      phosphor_logging,
67      cereal_dep],
68    include_directories: 'inc')
69