1project('phosphor-settingsd', 'cpp', 2 version: '1.0', 3 meson_version: '>=1.1.1', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++23', 8 ] 9) 10cpp = meson.get_compiler('cpp') 11 12python_prog = find_program('python3', native: true) 13 14# Define dependencies 15sdbusplus_dep = dependency('sdbusplus', required : false) 16phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 17phosphor_logging_dep = dependency('phosphor-logging') 18cereal_dep = dependency('cereal', required: false) 19has_cereal = cpp.has_header_symbol( 20 'cereal/cereal.hpp', 21 'cereal::specialize', 22 dependencies: cereal_dep, 23 required: false) 24if not has_cereal 25 cereal_opts = import('cmake').subproject_options() 26 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'}) 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') 33endif 34 35# Generate settings_manager.hpp 36settings_gen_env = {} 37if 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'} 41endif 42 43settings_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@' ], 52 env: settings_gen_env, 53) 54 55# Generate daemon 56settings_manager_sources = [ 57 settings_gen, 58] 59 60settings_manager_deps = [ 61 cereal_dep, 62 sdbusplus_dep, 63 phosphor_dbus_interfaces_dep, 64 phosphor_logging_dep, 65] 66 67executable( 68 'phosphor-settings-manager', 69 'settings_main.cpp', 70 settings_manager_sources, 71 dependencies: [ 72 settings_manager_deps, 73 ], 74 install: true, 75) 76