blob: 3302bc188a7f04e71f1fe7c90a36a9f545a25d8e [file] [log] [blame]
George Liu4b062012020-10-13 15:26:58 +08001project(
2 'phosphor-ledmanager', 'cpp',
3 version : '1.0.0',
George Liue367cea2021-05-04 10:25:43 +08004 meson_version: '>=0.57.0',
George Liu4b062012020-10-13 15:26:58 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
George Liue367cea2021-05-04 10:25:43 +08008 'cpp_std=c++20',
George Liudb6d7632021-12-27 14:11:01 +08009 'buildtype=debugoptimized',
George Liu4b062012020-10-13 15:26:58 +080010 ]
11)
12
13conf_data = configuration_data()
14conf_data.set_quoted('BUSNAME', 'xyz.openbmc_project.LED.GroupManager')
15conf_data.set_quoted('OBJPATH', '/xyz/openbmc_project/led/groups')
16conf_data.set_quoted('LED_JSON_FILE', '/usr/share/phosphor-led-manager/led-group-config.json')
17conf_data.set_quoted('SAVED_GROUPS_FILE', '/var/lib/phosphor-led-manager/savedGroups')
18conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
19conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault')
20conf_data.set_quoted('ELOG_ENTRY', 'entry')
21conf_data.set_quoted('LED_FAULT', 'fault')
22
23conf_data.set('CLASS_VERSION', 1)
24conf_data.set('LED_USE_JSON', get_option('use-json').enabled())
25conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').enabled())
George Liud76c0742021-04-15 17:56:03 +080026conf_data.set('MONITOR_OPERATIONAL_STATUS', get_option('monitor-operational-status').enabled())
George Liu4b062012020-10-13 15:26:58 +080027
Patrick Williams9bd334f2022-03-16 11:28:26 -050028sdbusplus_dep = dependency('sdbusplus')
George Liu4b062012020-10-13 15:26:58 +080029
George Liu687fe072021-05-04 16:16:43 +080030sdeventplus_dep = dependency(
31 'sdeventplus',
32 fallback: [
33 'sdeventplus',
34 'sdeventplus_dep'
35 ],
36)
37phosphor_logging_dep = dependency(
38 'phosphor-logging',
39 fallback: [
40 'phosphor-logging',
41 'phosphor_logging_dep'
42 ],
43)
44phosphor_dbus_interfaces_dep = dependency(
45 'phosphor-dbus-interfaces',
46 fallback: [
47 'phosphor-dbus-interfaces',
48 'phosphor_dbus_interfaces_dep'
49 ],
50)
George Liu4b062012020-10-13 15:26:58 +080051prog_python = find_program('python3', required: true)
52realpath_prog = find_program('realpath')
53
54cpp = meson.get_compiler('cpp')
55if cpp.has_header('nlohmann/json.hpp')
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050056 nlohmann_json_dep = declare_dependency()
George Liu4b062012020-10-13 15:26:58 +080057else
58 subproject('nlohmann', required: false)
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050059 nlohmann_json_dep = declare_dependency(
George Liu4b062012020-10-13 15:26:58 +080060 include_directories: [
61 'subprojects/nlohmann/single_include',
62 'subprojects/nlohmann/single_include/nlohmann',
63 ]
64 )
65endif
66
Patrick Williams7217c032022-03-16 16:26:09 -050067if cpp.has_header('CLI/CLI.hpp')
68 CLI11_dep = declare_dependency()
69else
70 CLI11_dep = dependency(
71 'CLI11',
72 fallback: [ 'CLI11', 'CLI11_dep' ],
73 )
74endif
75
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050076# Get Cereal dependency.
77cereal_dep = dependency('cereal', required: false)
78has_cereal = cpp.has_header_symbol(
79 'cereal/cereal.hpp',
80 'cereal::specialize',
81 dependencies: cereal_dep,
82 required: false)
83if not has_cereal
84 cereal_opts = import('cmake').subproject_options()
85 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF'})
86 cereal_proj = import('cmake').subproject(
87 'cereal',
88 options: cereal_opts,
89 required: false)
90 assert(cereal_proj.found(), 'cereal is required')
91 cereal_dep = cereal_proj.dependency('cereal')
92endif
93
George Liu4b062012020-10-13 15:26:58 +080094deps = [
Patrick Williams7217c032022-03-16 16:26:09 -050095 CLI11_dep,
96 cereal_dep,
97 nlohmann_json_dep,
98 phosphor_dbus_interfaces_dep,
99 phosphor_logging_dep,
George Liu4b062012020-10-13 15:26:58 +0800100 sdbusplus_dep,
George Liu687fe072021-05-04 16:16:43 +0800101 sdeventplus_dep,
George Liu4b062012020-10-13 15:26:58 +0800102]
103
Patrick Williams953315d2022-03-16 14:30:39 -0500104subdir('manager')
105subdir('fault-monitor')
George Liu4b062012020-10-13 15:26:58 +0800106
107configure_file(output: 'config.h',
108 configuration: conf_data
109)
110
111install_data(
112 'scripts/led-set-all-groups-asserted.sh',
113 install_dir: get_option('bindir')
114)
115
George Liu4b062012020-10-13 15:26:58 +0800116build_tests = get_option('tests')
117if not build_tests.disabled()
118 subdir('test')
119endif
George Liu629f4a32021-04-14 17:42:08 +0800120
121install_subdir('configs',
122 install_dir: get_option('datadir') / 'phosphor-led-manager',
123 strip_directory: true)