blob: e8310befbc4a786b57d6b27c2995e6c88c786b11 [file] [log] [blame]
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -07001project('phosphor-settingsd', 'cpp',
2 version: '1.0',
Patrick Williams3132eca2023-07-12 11:15:14 -05003 meson_version: '>=1.1.1',
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -07004 default_options: [
5 'warning_level=3',
6 'werror=true',
Patrick Williams3132eca2023-07-12 11:15:14 -05007 'cpp_std=c++23',
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -07008 ]
9)
10cpp = meson.get_compiler('cpp')
11
12python_prog = find_program('python3', native: true)
13
14# Define dependencies
Konstantin Aladyshevef9bd932024-04-04 17:17:52 +030015sdbusplus_dep = dependency('sdbusplus', required : false)
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -070016phosphor_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()
Konstantin Aladyshev96dc05d2024-04-02 18:38:46 +030026 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -070027 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
Konstantin Aladyshevef9bd932024-04-04 17:17:52 +030036settings_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
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -070043settings_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 Aladyshevef9bd932024-04-04 17:17:52 +030052 env: settings_gen_env,
Jagpal Singh Gill4d28bcd2023-04-23 23:34:05 -070053)
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)