blob: 45f968341643364a3618f542b934e0d5453a005b [file] [log] [blame]
Kuiying Wang642f4372020-08-12 15:35:46 +08001project(
2 'biosconfig-manager',
3 'cpp',
Patrick Williams9ace6ac2023-07-12 11:16:00 -05004 meson_version: '>=1.1.1',
Kuiying Wang642f4372020-08-12 15:35:46 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams9ace6ac2023-07-12 11:16:00 -05008 'cpp_std=c++23',
Manojkiran Eda814a3562024-10-03 09:50:04 +05309 'buildtype=debugoptimized',
Kuiying Wang642f4372020-08-12 15:35:46 +080010 ],
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
Tom Josephf1101df2020-11-06 08:23:34 +053021conf_data = configuration_data()
22conf_data.set_quoted('BIOS_PERSIST_PATH', get_option('bios-persist-path'))
23configure_file(output: 'config.h', configuration: conf_data)
24
Manojkiran Eda814a3562024-10-03 09:50:04 +053025boost_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]
Kuiying Wang642f4372020-08-12 15:35:46 +080033
Manojkiran Eda814a3562024-10-03 09:50:04 +053034deps = [
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'),
Kuiying Wang642f4372020-08-12 15:35:46 +080042]
43
Manojkiran Eda72bed802024-01-24 06:18:48 -060044cereal = 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,
Manojkiran Eda814a3562024-10-03 09:50:04 +053050 required: false,
51)
Manojkiran Eda72bed802024-01-24 06:18:48 -060052if not has_cereal
53 cereal_opts = import('cmake').subproject_options()
Konstantin Aladyshevd5e2af72024-04-22 16:23:16 +030054 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
Manojkiran Eda72bed802024-01-24 06:18:48 -060055 cereal_proj = import('cmake').subproject(
56 'cereal',
57 options: cereal_opts,
Manojkiran Eda814a3562024-10-03 09:50:04 +053058 required: false,
59 )
Manojkiran Eda72bed802024-01-24 06:18:48 -060060 assert(cereal_proj.found(), 'cereal is required')
61 cereal = cereal_proj.dependency('cereal')
62endif
63deps += cereal
64
Manojkiran Eda814a3562024-10-03 09:50:04 +053065src_files = [
66 'src/main.cpp',
67 'src/manager.cpp',
68 'src/manager_serialize.cpp',
69 'src/password.cpp',
Arun Lal K M1a1dfbd2023-01-17 06:38:19 +000070]
Kuiying Wang642f4372020-08-12 15:35:46 +080071
Manojkiran Eda814a3562024-10-03 09:50:04 +053072executable(
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)
Kuiying Wang8f706212020-12-16 18:59:24 +080082
Kuiying Wang642f4372020-08-12 15:35:46 +080083systemd = dependency('systemd')
George Liu6a7ee5c2021-12-29 13:53:52 +080084systemd_system_unit_dir = systemd.get_variable(
Patrick Williamsc76391b2023-04-12 08:01:25 -050085 'systemdsystemunitdir',
Manojkiran Eda814a3562024-10-03 09:50:04 +053086 pkgconfig_define: ['prefix', get_option('prefix')],
87)
Kuiying Wang642f4372020-08-12 15:35:46 +080088
George Liu628e4aa2023-08-16 13:58:42 +080089fs = import('fs')
90fs.copyfile(
91 'service_files/xyz.openbmc_project.biosconfig_manager.service',
Kuiying Wang642f4372020-08-12 15:35:46 +080092 install: true,
Manojkiran Eda814a3562024-10-03 09:50:04 +053093 install_dir: systemd_system_unit_dir,
Kuiying Wang642f4372020-08-12 15:35:46 +080094)