xref: /openbmc/bios-settings-mgr/meson.build (revision 5c7e80d5a431d7cb9645a6e0b30627bbcb40c633)
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
21boost_args = [
22    '-DBOOST_ALL_NO_LIB',
23    '-DBOOST_ASIO_DISABLE_THREADS',
24    '-DBOOST_ERROR_CODE_HEADER_ONLY',
25    '-DBOOST_NO_RTTI',
26    '-DBOOST_NO_TYPEID',
27    '-DBOOST_SYSTEM_NO_DEPRECATED',
28]
29
30deps = [
31    dependency('boost'),
32    dependency('phosphor-dbus-interfaces'),
33    dependency('phosphor-logging'),
34    dependency('sdbusplus'),
35    dependency('libsystemd'),
36    dependency('openssl'),
37    dependency('nlohmann_json', include_type: 'system'),
38]
39
40cereal = dependency('cereal', required: false)
41cpp = meson.get_compiler('cpp')
42has_cereal = cpp.has_header_symbol(
43    'cereal/cereal.hpp',
44    'cereal::specialize',
45    dependencies: cereal,
46    required: false,
47)
48if not has_cereal
49    cereal_opts = import('cmake').subproject_options()
50    cereal_opts.add_cmake_defines(
51        {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
52    )
53    cereal_proj = import('cmake').subproject(
54        'cereal',
55        options: cereal_opts,
56        required: false,
57    )
58    assert(cereal_proj.found(), 'cereal is required')
59    cereal = cereal_proj.dependency('cereal')
60endif
61deps += cereal
62
63src_files = [
64    'src/main.cpp',
65    'src/manager.cpp',
66    'src/manager_serialize.cpp',
67    'src/password.cpp',
68]
69
70executable(
71    'biosconfig-manager',
72    src_files,
73    implicit_include_directories: true,
74    include_directories: ['include'],
75    dependencies: deps,
76    cpp_args: boost_args,
77    install: true,
78    install_dir: get_option('bindir'),
79)
80
81systemd = dependency('systemd')
82systemd_system_unit_dir = systemd.get_variable(
83    'systemdsystemunitdir',
84    pkgconfig_define: ['prefix', get_option('prefix')],
85)
86
87fs = import('fs')
88fs.copyfile(
89    'service_files/xyz.openbmc_project.biosconfig_manager.service',
90    install: true,
91    install_dir: systemd_system_unit_dir,
92)
93