Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 1 | project( |
| 2 | 'phosphor-settingsd', |
| 3 | 'cpp', |
| 4 | version: '1.0', |
| 5 | meson_version: '>=1.1.1', |
| 6 | default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++23'], |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 7 | ) |
| 8 | cpp = meson.get_compiler('cpp') |
| 9 | |
| 10 | python_prog = find_program('python3', native: true) |
| 11 | |
| 12 | # Define dependencies |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 13 | sdbusplus_dep = dependency('sdbusplus', required: false) |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 14 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 15 | phosphor_logging_dep = dependency('phosphor-logging') |
| 16 | cereal_dep = dependency('cereal', required: false) |
| 17 | has_cereal = cpp.has_header_symbol( |
| 18 | 'cereal/cereal.hpp', |
| 19 | 'cereal::specialize', |
| 20 | dependencies: cereal_dep, |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 21 | required: false, |
| 22 | ) |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 23 | if not has_cereal |
| 24 | cereal_opts = import('cmake').subproject_options() |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 25 | cereal_opts.add_cmake_defines( |
| 26 | {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}, |
| 27 | ) |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 28 | cereal_proj = import('cmake').subproject( |
| 29 | 'cereal', |
| 30 | options: cereal_opts, |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 31 | required: false, |
| 32 | ) |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 33 | assert(cereal_proj.found(), 'cereal is required') |
| 34 | cereal_dep = cereal_proj.dependency('cereal') |
| 35 | endif |
| 36 | |
| 37 | # Generate settings_manager.hpp |
Konstantin Aladyshev | ef9bd93 | 2024-04-04 17:17:52 +0300 | [diff] [blame] | 38 | settings_gen_env = {} |
| 39 | if not sdbusplus_dep.found() |
| 40 | sdbusplus_proj = subproject('sdbusplus') |
| 41 | sdbusplus_dep = sdbusplus_proj.get_variable('sdbusplus_dep') |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 42 | settings_gen_env = { |
| 43 | 'PYTHONPATH': meson.current_source_dir() / 'subprojects' / 'sdbusplus' / 'tools', |
| 44 | } |
Konstantin Aladyshev | ef9bd93 | 2024-04-04 17:17:52 +0300 | [diff] [blame] | 45 | endif |
| 46 | |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 47 | settings_gen = custom_target( |
| 48 | 'settings_manager.hpp'.underscorify(), |
| 49 | input: [ |
| 50 | 'settings.py', |
| 51 | 'settings_manager.mako.hpp', |
| 52 | get_option('settings_yaml'), |
| 53 | ], |
| 54 | output: 'settings_manager.hpp', |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 55 | command: [python_prog, '@INPUT0@', '-i', '@INPUT2@'], |
Konstantin Aladyshev | ef9bd93 | 2024-04-04 17:17:52 +0300 | [diff] [blame] | 56 | env: settings_gen_env, |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 57 | ) |
| 58 | |
| 59 | # Generate daemon |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 60 | settings_manager_sources = [settings_gen] |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 61 | |
| 62 | settings_manager_deps = [ |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 63 | cereal_dep, |
| 64 | sdbusplus_dep, |
| 65 | phosphor_dbus_interfaces_dep, |
| 66 | phosphor_logging_dep, |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 67 | ] |
| 68 | |
| 69 | executable( |
| 70 | 'phosphor-settings-manager', |
| 71 | 'settings_main.cpp', |
| 72 | settings_manager_sources, |
Patrick Williams | 3c3319a | 2025-02-01 08:36:35 -0500 | [diff] [blame^] | 73 | dependencies: [settings_manager_deps], |
Jagpal Singh Gill | 4d28bcd | 2023-04-23 23:34:05 -0700 | [diff] [blame] | 74 | install: true, |
| 75 | ) |