Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 1 | project( |
| 2 | 'biosconfig-manager', |
| 3 | 'cpp', |
Patrick Williams | 9ace6ac | 2023-07-12 11:16:00 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
Patrick Williams | 9ace6ac | 2023-07-12 11:16:00 -0500 | [diff] [blame] | 8 | 'cpp_std=c++23', |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 9 | 'buildtype=debugoptimized', |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 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. |
| 19 | add_project_arguments('-Wno-psabi', language: 'cpp') |
| 20 | |
Prithvi Pai | 627c99d | 2025-02-08 14:05:25 +0530 | [diff] [blame] | 21 | conf_data = configuration_data() |
| 22 | if (get_option('enable-bios-secureboot').allowed()) |
| 23 | add_project_arguments('-DENABLE_BIOS_SECUREBOOT', language: 'cpp') |
| 24 | endif |
| 25 | configure_file(output: 'configuration.h', configuration: conf_data) |
| 26 | |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 27 | boost_args = [ |
| 28 | '-DBOOST_ALL_NO_LIB', |
| 29 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 30 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 31 | '-DBOOST_NO_RTTI', |
| 32 | '-DBOOST_NO_TYPEID', |
| 33 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 34 | ] |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 35 | |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 36 | deps = [ |
| 37 | dependency('boost'), |
| 38 | dependency('phosphor-dbus-interfaces'), |
| 39 | dependency('phosphor-logging'), |
| 40 | dependency('sdbusplus'), |
| 41 | dependency('libsystemd'), |
| 42 | dependency('openssl'), |
| 43 | dependency('nlohmann_json', include_type: 'system'), |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 44 | ] |
| 45 | |
Manojkiran Eda | 72bed80 | 2024-01-24 06:18:48 -0600 | [diff] [blame] | 46 | cereal = dependency('cereal', required: false) |
| 47 | cpp = meson.get_compiler('cpp') |
| 48 | has_cereal = cpp.has_header_symbol( |
| 49 | 'cereal/cereal.hpp', |
| 50 | 'cereal::specialize', |
| 51 | dependencies: cereal, |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 52 | required: false, |
| 53 | ) |
Manojkiran Eda | 72bed80 | 2024-01-24 06:18:48 -0600 | [diff] [blame] | 54 | if not has_cereal |
| 55 | cereal_opts = import('cmake').subproject_options() |
Manojkiran Eda | 9fc9a98 | 2024-10-10 06:31:27 +0530 | [diff] [blame] | 56 | cereal_opts.add_cmake_defines( |
| 57 | {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}, |
| 58 | ) |
Manojkiran Eda | 72bed80 | 2024-01-24 06:18:48 -0600 | [diff] [blame] | 59 | cereal_proj = import('cmake').subproject( |
| 60 | 'cereal', |
| 61 | options: cereal_opts, |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 62 | required: false, |
| 63 | ) |
Manojkiran Eda | 72bed80 | 2024-01-24 06:18:48 -0600 | [diff] [blame] | 64 | assert(cereal_proj.found(), 'cereal is required') |
| 65 | cereal = cereal_proj.dependency('cereal') |
| 66 | endif |
| 67 | deps += cereal |
| 68 | |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 69 | src_files = [ |
| 70 | 'src/main.cpp', |
| 71 | 'src/manager.cpp', |
| 72 | 'src/manager_serialize.cpp', |
| 73 | 'src/password.cpp', |
Prithvi Pai | 627c99d | 2025-02-08 14:05:25 +0530 | [diff] [blame] | 74 | 'src/secureboot.cpp', |
Arun Lal K M | 1a1dfbd | 2023-01-17 06:38:19 +0000 | [diff] [blame] | 75 | ] |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 76 | |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 77 | executable( |
| 78 | 'biosconfig-manager', |
| 79 | src_files, |
| 80 | implicit_include_directories: true, |
| 81 | include_directories: ['include'], |
| 82 | dependencies: deps, |
| 83 | cpp_args: boost_args, |
| 84 | install: true, |
| 85 | install_dir: get_option('bindir'), |
| 86 | ) |
Kuiying Wang | 8f70621 | 2020-12-16 18:59:24 +0800 | [diff] [blame] | 87 | |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 88 | systemd = dependency('systemd') |
George Liu | 6a7ee5c | 2021-12-29 13:53:52 +0800 | [diff] [blame] | 89 | systemd_system_unit_dir = systemd.get_variable( |
Patrick Williams | ae91a56 | 2025-07-09 11:27:43 -0400 | [diff] [blame^] | 90 | 'systemd_system_unit_dir', |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 91 | pkgconfig_define: ['prefix', get_option('prefix')], |
| 92 | ) |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 93 | |
George Liu | 628e4aa | 2023-08-16 13:58:42 +0800 | [diff] [blame] | 94 | fs = import('fs') |
| 95 | fs.copyfile( |
| 96 | 'service_files/xyz.openbmc_project.biosconfig_manager.service', |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 97 | install: true, |
Manojkiran Eda | 814a356 | 2024-10-03 09:50:04 +0530 | [diff] [blame] | 98 | install_dir: systemd_system_unit_dir, |
Kuiying Wang | 642f437 | 2020-08-12 15:35:46 +0800 | [diff] [blame] | 99 | ) |