blob: f1a65a851a383bc5f6fff8779261ad9b9cf83f85 [file] [log] [blame]
George Liu4b062012020-10-13 15:26:58 +08001project(
2 'phosphor-ledmanager', 'cpp',
3 version : '1.0.0',
Patrick Williams959b4822023-07-12 11:15:13 -05004 meson_version: '>=1.1.1',
George Liu4b062012020-10-13 15:26:58 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams959b4822023-07-12 11:15:13 -05008 'cpp_std=c++23',
George Liudb6d7632021-12-27 14:11:01 +08009 'buildtype=debugoptimized',
George Liu4b062012020-10-13 15:26:58 +080010 ]
11)
12
13conf_data = configuration_data()
George Liu4b062012020-10-13 15:26:58 +080014conf_data.set_quoted('LED_JSON_FILE', '/usr/share/phosphor-led-manager/led-group-config.json')
15conf_data.set_quoted('SAVED_GROUPS_FILE', '/var/lib/phosphor-led-manager/savedGroups')
16conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
17conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault')
18conf_data.set_quoted('ELOG_ENTRY', 'entry')
19conf_data.set_quoted('LED_FAULT', 'fault')
20
21conf_data.set('CLASS_VERSION', 1)
22conf_data.set('LED_USE_JSON', get_option('use-json').enabled())
23conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').enabled())
George Liud76c0742021-04-15 17:56:03 +080024conf_data.set('MONITOR_OPERATIONAL_STATUS', get_option('monitor-operational-status').enabled())
George Liu4b062012020-10-13 15:26:58 +080025
Patrick Williams9bd334f2022-03-16 11:28:26 -050026sdbusplus_dep = dependency('sdbusplus')
Patrick Williamsa821dea2022-03-21 09:43:07 -050027sdeventplus_dep = dependency('sdeventplus')
28phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
29phosphor_logging_dep = dependency('phosphor-logging')
George Liu4b062012020-10-13 15:26:58 +080030
George Liu4b062012020-10-13 15:26:58 +080031prog_python = find_program('python3', required: true)
32realpath_prog = find_program('realpath')
33
34cpp = meson.get_compiler('cpp')
35if cpp.has_header('nlohmann/json.hpp')
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050036 nlohmann_json_dep = declare_dependency()
George Liu4b062012020-10-13 15:26:58 +080037else
38 subproject('nlohmann', required: false)
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050039 nlohmann_json_dep = declare_dependency(
George Liu4b062012020-10-13 15:26:58 +080040 include_directories: [
41 'subprojects/nlohmann/single_include',
42 'subprojects/nlohmann/single_include/nlohmann',
43 ]
44 )
45endif
46
Patrick Williams7217c032022-03-16 16:26:09 -050047if cpp.has_header('CLI/CLI.hpp')
48 CLI11_dep = declare_dependency()
49else
Patrick Williamsa821dea2022-03-21 09:43:07 -050050 CLI11_dep = dependency('CLI11')
Patrick Williams7217c032022-03-16 16:26:09 -050051endif
52
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050053# Get Cereal dependency.
54cereal_dep = dependency('cereal', required: false)
55has_cereal = cpp.has_header_symbol(
56 'cereal/cereal.hpp',
57 'cereal::specialize',
58 dependencies: cereal_dep,
59 required: false)
60if not has_cereal
61 cereal_opts = import('cmake').subproject_options()
62 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
63 cereal_proj = import('cmake').subproject(
64 'cereal',
65 options: cereal_opts,
66 required: false)
67 assert(cereal_proj.found(), 'cereal is required')
68 cereal_dep = cereal_proj.dependency('cereal')
69endif
70
George Liu4b062012020-10-13 15:26:58 +080071deps = [
Patrick Williams7217c032022-03-16 16:26:09 -050072 CLI11_dep,
73 cereal_dep,
74 nlohmann_json_dep,
75 phosphor_dbus_interfaces_dep,
76 phosphor_logging_dep,
George Liu4b062012020-10-13 15:26:58 +080077 sdbusplus_dep,
George Liu687fe072021-05-04 16:16:43 +080078 sdeventplus_dep,
George Liu4b062012020-10-13 15:26:58 +080079]
80
Patrick Williams953315d2022-03-16 14:30:39 -050081subdir('manager')
82subdir('fault-monitor')
George Liu4b062012020-10-13 15:26:58 +080083
84configure_file(output: 'config.h',
85 configuration: conf_data
86)
87
88install_data(
89 'scripts/led-set-all-groups-asserted.sh',
90 install_dir: get_option('bindir')
91)
92
George Liu049700c2023-08-07 17:28:30 +080093if get_option('tests').allowed()
George Liu4b062012020-10-13 15:26:58 +080094 subdir('test')
95endif
George Liu629f4a32021-04-14 17:42:08 +080096
97install_subdir('configs',
98 install_dir: get_option('datadir') / 'phosphor-led-manager',
99 strip_directory: true)