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