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 |
| 15 | sdbusplus_dep = dependency('sdbusplus') |
| 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() |
| 26 | cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'}) |
| 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 |
| 36 | settings_gen = custom_target( |
| 37 | 'settings_manager.hpp'.underscorify(), |
| 38 | input: [ |
| 39 | 'settings.py', |
| 40 | 'settings_manager.mako.hpp', |
| 41 | get_option('settings_yaml'), |
| 42 | ], |
| 43 | output: 'settings_manager.hpp', |
| 44 | command: [ python_prog, '@INPUT0@', '-i', '@INPUT2@' ], |
| 45 | ) |
| 46 | |
| 47 | # Generate daemon |
| 48 | settings_manager_sources = [ |
| 49 | settings_gen, |
| 50 | ] |
| 51 | |
| 52 | settings_manager_deps = [ |
| 53 | cereal_dep, |
| 54 | sdbusplus_dep, |
| 55 | phosphor_dbus_interfaces_dep, |
| 56 | phosphor_logging_dep, |
| 57 | ] |
| 58 | |
| 59 | executable( |
| 60 | 'phosphor-settings-manager', |
| 61 | 'settings_main.cpp', |
| 62 | settings_manager_sources, |
| 63 | dependencies: [ |
| 64 | settings_manager_deps, |
| 65 | ], |
| 66 | install: true, |
| 67 | ) |