xref: /openbmc/phosphor-led-manager/meson.build (revision 543ac9f16ff63c9d18d9d2aab5c9a142e66c19c9)
1project(
2    'phosphor-ledmanager', 'cpp',
3    version : '1.0.0',
4    meson_version: '>=1.1.1',
5    default_options: [
6        'warning_level=3',
7        'werror=true',
8        'cpp_std=c++23',
9        'buildtype=debugoptimized',
10    ]
11)
12
13cpp = meson.get_compiler('cpp')
14
15conf_data = configuration_data()
16conf_data.set_quoted('SAVED_GROUPS_FILE', '/var/lib/phosphor-led-manager/savedGroups')
17conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
18conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault')
19conf_data.set_quoted('ELOG_ENTRY', 'entry')
20conf_data.set_quoted('LED_FAULT', 'fault')
21
22conf_data.set('CLASS_VERSION', 1)
23conf_data.set('LED_USE_JSON', get_option('use-json').allowed())
24conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').allowed())
25conf_data.set('MONITOR_OPERATIONAL_STATUS', get_option('monitor-operational-status').allowed())
26conf_data.set('PERSISTENT_LED_ASSERTED', get_option('persistent-led-asserted').allowed())
27
28nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
29phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
30phosphor_logging_dep = dependency('phosphor-logging')
31sdbusplus_dep = dependency('sdbusplus')
32sdeventplus_dep = dependency('sdeventplus')
33
34prog_python = find_program('python3', required: true)
35realpath_prog = find_program('realpath')
36
37
38if cpp.has_header('CLI/CLI.hpp')
39    CLI11_dep = declare_dependency()
40else
41    CLI11_dep = dependency('CLI11')
42endif
43
44# Get Cereal dependency.
45cereal_dep = dependency('cereal', required: false)
46has_cereal = cpp.has_header_symbol(
47    'cereal/cereal.hpp',
48    'cereal::specialize',
49    dependencies: cereal_dep,
50    required: false)
51if not has_cereal
52    cereal_opts = import('cmake').subproject_options()
53    cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
54    cereal_proj = import('cmake').subproject(
55        'cereal',
56        options: cereal_opts,
57        required: false)
58    assert(cereal_proj.found(), 'cereal is required')
59    cereal_dep = cereal_proj.dependency('cereal')
60endif
61
62deps = [
63    CLI11_dep,
64    cereal_dep,
65    nlohmann_json_dep,
66    phosphor_dbus_interfaces_dep,
67    phosphor_logging_dep,
68    sdbusplus_dep,
69    sdeventplus_dep,
70]
71
72subdir('manager')
73subdir('fault-monitor')
74
75configure_file(output: 'config.h',
76    configuration: conf_data
77)
78
79install_data(
80    'scripts/led-set-all-groups-asserted.sh',
81    install_dir: get_option('bindir')
82)
83
84if get_option('tests').allowed()
85  subdir('test')
86endif
87
88install_subdir('configs',
89    install_dir: get_option('datadir') / 'phosphor-led-manager',
90    strip_directory: true)
91