blob: 1314efe44e53950ffe553949f9a364bbca5d4219 [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
Manojkiran Eda814a3562024-10-03 09:50:04 +053021boost_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]
Kuiying Wang642f4372020-08-12 15:35:46 +080029
Manojkiran Eda814a3562024-10-03 09:50:04 +053030deps = [
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'),
Kuiying Wang642f4372020-08-12 15:35:46 +080038]
39
Manojkiran Eda72bed802024-01-24 06:18:48 -060040cereal = 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,
Manojkiran Eda814a3562024-10-03 09:50:04 +053046 required: false,
47)
Manojkiran Eda72bed802024-01-24 06:18:48 -060048if not has_cereal
49 cereal_opts = import('cmake').subproject_options()
Manojkiran Eda9fc9a982024-10-10 06:31:27 +053050 cereal_opts.add_cmake_defines(
51 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
52 )
Manojkiran Eda72bed802024-01-24 06:18:48 -060053 cereal_proj = import('cmake').subproject(
54 'cereal',
55 options: cereal_opts,
Manojkiran Eda814a3562024-10-03 09:50:04 +053056 required: false,
57 )
Manojkiran Eda72bed802024-01-24 06:18:48 -060058 assert(cereal_proj.found(), 'cereal is required')
59 cereal = cereal_proj.dependency('cereal')
60endif
61deps += cereal
62
Manojkiran Eda814a3562024-10-03 09:50:04 +053063src_files = [
64 'src/main.cpp',
65 'src/manager.cpp',
66 'src/manager_serialize.cpp',
67 'src/password.cpp',
Arun Lal K M1a1dfbd2023-01-17 06:38:19 +000068]
Kuiying Wang642f4372020-08-12 15:35:46 +080069
Manojkiran Eda814a3562024-10-03 09:50:04 +053070executable(
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)
Kuiying Wang8f706212020-12-16 18:59:24 +080080
Kuiying Wang642f4372020-08-12 15:35:46 +080081systemd = dependency('systemd')
George Liu6a7ee5c2021-12-29 13:53:52 +080082systemd_system_unit_dir = systemd.get_variable(
Patrick Williamsc76391b2023-04-12 08:01:25 -050083 'systemdsystemunitdir',
Manojkiran Eda814a3562024-10-03 09:50:04 +053084 pkgconfig_define: ['prefix', get_option('prefix')],
85)
Kuiying Wang642f4372020-08-12 15:35:46 +080086
George Liu628e4aa2023-08-16 13:58:42 +080087fs = import('fs')
88fs.copyfile(
89 'service_files/xyz.openbmc_project.biosconfig_manager.service',
Kuiying Wang642f4372020-08-12 15:35:46 +080090 install: true,
Manojkiran Eda814a3562024-10-03 09:50:04 +053091 install_dir: systemd_system_unit_dir,
Kuiying Wang642f4372020-08-12 15:35:46 +080092)