blob: ed71cc61fb5c9e80ac37503145edfd08a228c7d1 [file] [log] [blame]
George Liu4b062012020-10-13 15:26:58 +08001project(
Patrick Williams42a4acb2025-02-01 08:36:31 -05002 'phosphor-ledmanager',
3 'cpp',
4 version: '1.0.0',
Patrick Williams959b4822023-07-12 11:15:13 -05005 meson_version: '>=1.1.1',
George Liu4b062012020-10-13 15:26:58 +08006 default_options: [
7 'warning_level=3',
8 'werror=true',
Patrick Williams959b4822023-07-12 11:15:13 -05009 'cpp_std=c++23',
George Liudb6d7632021-12-27 14:11:01 +080010 'buildtype=debugoptimized',
Patrick Williams42a4acb2025-02-01 08:36:31 -050011 ],
George Liu4b062012020-10-13 15:26:58 +080012)
13
Patrick Williams6fc35622023-12-07 17:10:47 -060014cpp = meson.get_compiler('cpp')
15
George Liu4b062012020-10-13 15:26:58 +080016conf_data = configuration_data()
Patrick Williams42a4acb2025-02-01 08:36:31 -050017conf_data.set_quoted(
18 'SAVED_GROUPS_FILE',
19 '/var/lib/phosphor-led-manager/savedGroups',
20)
George Liu4b062012020-10-13 15:26:58 +080021conf_data.set_quoted('CALLOUT_FWD_ASSOCIATION', 'callout')
22conf_data.set_quoted('CALLOUT_REV_ASSOCIATION', 'fault')
23conf_data.set_quoted('ELOG_ENTRY', 'entry')
24conf_data.set_quoted('LED_FAULT', 'fault')
25
26conf_data.set('CLASS_VERSION', 1)
Patrick Williams95b0db92023-11-29 06:43:59 -060027conf_data.set('LED_USE_JSON', get_option('use-json').allowed())
28conf_data.set('USE_LAMP_TEST', get_option('use-lamp-test').allowed())
Patrick Williams42a4acb2025-02-01 08:36:31 -050029conf_data.set(
30 'MONITOR_OPERATIONAL_STATUS',
31 get_option('monitor-operational-status').allowed(),
32)
33conf_data.set(
34 'PERSISTENT_LED_ASSERTED',
35 get_option('persistent-led-asserted').allowed(),
36)
George Liu4b062012020-10-13 15:26:58 +080037
Patrick Williams6fc35622023-12-07 17:10:47 -060038nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsa821dea2022-03-21 09:43:07 -050039phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
40phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams6fc35622023-12-07 17:10:47 -060041sdbusplus_dep = dependency('sdbusplus')
42sdeventplus_dep = dependency('sdeventplus')
George Liu4b062012020-10-13 15:26:58 +080043
George Liu4b062012020-10-13 15:26:58 +080044prog_python = find_program('python3', required: true)
45realpath_prog = find_program('realpath')
46
George Liu4b062012020-10-13 15:26:58 +080047
Patrick Williams7217c032022-03-16 16:26:09 -050048if cpp.has_header('CLI/CLI.hpp')
49 CLI11_dep = declare_dependency()
50else
Patrick Williamsa821dea2022-03-21 09:43:07 -050051 CLI11_dep = dependency('CLI11')
Patrick Williams7217c032022-03-16 16:26:09 -050052endif
53
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050054# Get Cereal dependency.
55cereal_dep = dependency('cereal', required: false)
56has_cereal = cpp.has_header_symbol(
57 'cereal/cereal.hpp',
58 'cereal::specialize',
59 dependencies: cereal_dep,
Patrick Williams42a4acb2025-02-01 08:36:31 -050060 required: false,
61)
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050062if not has_cereal
63 cereal_opts = import('cmake').subproject_options()
Patrick Williams42a4acb2025-02-01 08:36:31 -050064 cereal_opts.add_cmake_defines(
65 {'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'},
66 )
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050067 cereal_proj = import('cmake').subproject(
68 'cereal',
69 options: cereal_opts,
Patrick Williams42a4acb2025-02-01 08:36:31 -050070 required: false,
71 )
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050072 assert(cereal_proj.found(), 'cereal is required')
73 cereal_dep = cereal_proj.dependency('cereal')
74endif
75
George Liu4b062012020-10-13 15:26:58 +080076deps = [
Patrick Williams7217c032022-03-16 16:26:09 -050077 CLI11_dep,
78 cereal_dep,
79 nlohmann_json_dep,
80 phosphor_dbus_interfaces_dep,
81 phosphor_logging_dep,
George Liu4b062012020-10-13 15:26:58 +080082 sdbusplus_dep,
George Liu687fe072021-05-04 16:16:43 +080083 sdeventplus_dep,
George Liu4b062012020-10-13 15:26:58 +080084]
85
Patrick Williams953315d2022-03-16 14:30:39 -050086subdir('manager')
87subdir('fault-monitor')
George Liu4b062012020-10-13 15:26:58 +080088
Patrick Williams42a4acb2025-02-01 08:36:31 -050089configure_file(output: 'config.h', configuration: conf_data)
George Liu4b062012020-10-13 15:26:58 +080090
91install_data(
92 'scripts/led-set-all-groups-asserted.sh',
Patrick Williams42a4acb2025-02-01 08:36:31 -050093 install_dir: get_option('bindir'),
George Liu4b062012020-10-13 15:26:58 +080094)
95
George Liu049700c2023-08-07 17:28:30 +080096if get_option('tests').allowed()
Patrick Williams42a4acb2025-02-01 08:36:31 -050097 subdir('test')
George Liu4b062012020-10-13 15:26:58 +080098endif
George Liu629f4a32021-04-14 17:42:08 +080099
Patrick Williams42a4acb2025-02-01 08:36:31 -0500100install_subdir(
101 'configs',
George Liu629f4a32021-04-14 17:42:08 +0800102 install_dir: get_option('datadir') / 'phosphor-led-manager',
Patrick Williams42a4acb2025-02-01 08:36:31 -0500103 strip_directory: true,
104)