xref: /openbmc/bios-settings-mgr/meson.build (revision d5e2af74)
1project(
2    'biosconfig-manager',
3    'cpp',
4    meson_version: '>=1.1.1',
5    default_options: [
6        'warning_level=3',
7        'werror=true',
8        'cpp_std=c++23',
9        'buildtype=debugoptimized',
10    ],
11    license: 'Apache-2.0',
12    version: '1.0',
13)
14
15# Wno-psabi reduces the number of "Note:" messages when cross-compiling some STL
16# stuff for ARM. See https://stackoverflow.com/questions/48149323/strange-gcc-warning-when-compiling-qt-project
17# Basically, gcc 6 and gcc 7 are not ABI compatible, but since the whole OpenBMC
18# project uses the same compiler, we can safely ignmore these info notes.
19add_project_arguments('-Wno-psabi', language: 'cpp')
20
21conf_data = configuration_data()
22conf_data.set_quoted('BIOS_PERSIST_PATH', get_option('bios-persist-path'))
23configure_file(output: 'config.h', configuration: conf_data)
24
25boost_args = [
26    '-DBOOST_ALL_NO_LIB',
27    '-DBOOST_ASIO_DISABLE_THREADS',
28    '-DBOOST_ERROR_CODE_HEADER_ONLY',
29    '-DBOOST_NO_RTTI',
30    '-DBOOST_NO_TYPEID',
31    '-DBOOST_SYSTEM_NO_DEPRECATED',
32]
33
34deps = [
35    dependency('boost'),
36    dependency('phosphor-dbus-interfaces'),
37    dependency('phosphor-logging'),
38    dependency('sdbusplus'),
39    dependency('libsystemd'),
40    dependency('openssl'),
41    dependency('nlohmann_json', include_type: 'system'),
42]
43
44cereal = dependency('cereal', required: false)
45cpp = meson.get_compiler('cpp')
46has_cereal = cpp.has_header_symbol(
47    'cereal/cereal.hpp',
48    'cereal::specialize',
49    dependencies: cereal,
50    required: false,
51)
52if not has_cereal
53    cereal_opts = import('cmake').subproject_options()
54    cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
55    cereal_proj = import('cmake').subproject(
56        'cereal',
57        options: cereal_opts,
58        required: false,
59    )
60    assert(cereal_proj.found(), 'cereal is required')
61    cereal = cereal_proj.dependency('cereal')
62endif
63deps += cereal
64
65src_files = [
66    'src/main.cpp',
67    'src/manager.cpp',
68    'src/manager_serialize.cpp',
69    'src/password.cpp',
70]
71
72executable(
73    'biosconfig-manager',
74    src_files,
75    implicit_include_directories: true,
76    include_directories: ['include'],
77    dependencies: deps,
78    cpp_args: boost_args,
79    install: true,
80    install_dir: get_option('bindir'),
81)
82
83systemd = dependency('systemd')
84systemd_system_unit_dir = systemd.get_variable(
85    'systemdsystemunitdir',
86    pkgconfig_define: ['prefix', get_option('prefix')],
87)
88
89fs = import('fs')
90fs.copyfile(
91    'service_files/xyz.openbmc_project.biosconfig_manager.service',
92    install: true,
93    install_dir: systemd_system_unit_dir,
94)
95