blob: 2c44f7250f64c9f00bfab832292dabf45713c817 [file] [log] [blame]
Manojkiran Eda84855ab2021-12-05 11:09:02 +05301project(
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'))
19
20if get_option('bios-post-code-log').enabled()
21 add_project_arguments('-DENABLE_BIOS_POST_CODE_LOG',language: 'cpp')
22endif
23
24configure_file(output: 'config.h',
25 configuration: conf_data
26)
27
28sdbusplus = dependency(
29 'sdbusplus',
30 fallback: ['sdbusplus', 'sdbusplus_dep']
31)
32
33phosphor_logging = dependency(
34 'phosphor-logging',
35 fallback: [
36 'phosphor-logging',
37 'phosphor_logging_dep'])
38
39phosphor_dbus_interfaces = dependency(
40 'phosphor-dbus-interfaces',
41 fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep']
42)
43
44cxx = meson.get_compiler('cpp')
45cereal_dep = dependency('cereal', required: false)
46has_cereal = cxx.has_header_symbol(
47 'cereal/cereal.hpp',
48 'cereal::specialize',
49 dependencies: cereal_dep,
50 required: false)
51if not has_cereal
52 cereal_opts = import('cmake').subproject_options()
53 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
54 cereal_proj = import('cmake').subproject(
55 'cereal',
56 options: cereal_opts,
57 required: false)
58 assert(cereal_proj.found(), 'cereal is required')
59 cereal_dep = cereal_proj.dependency('cereal')
60endif
61
62systemd_system_unit_dir = dependency('systemd').get_variable(
63 pkgconfig: 'systemdsystemunitdir')
64
65install_subdir('service_files',
66 install_dir : systemd_system_unit_dir,
67 strip_directory : true)
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 include_directories: 'inc')