blob: 2aaac45989ef2f0b67b705158a7c16f83d1bfb81 [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
Patrick Williams6fc35622023-12-07 17:10:47 -060013cpp = meson.get_compiler('cpp')
14
George Liu4b062012020-10-13 15:26:58 +080015conf_data = configuration_data()
George Liu4b062012020-10-13 15:26:58 +080016conf_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)
Patrick Williams95b0db92023-11-29 06:43:59 -060023conf_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())
George Liu4b062012020-10-13 15:26:58 +080027
Patrick Williams6fc35622023-12-07 17:10:47 -060028nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsa821dea2022-03-21 09:43:07 -050029phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
30phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams6fc35622023-12-07 17:10:47 -060031sdbusplus_dep = dependency('sdbusplus')
32sdeventplus_dep = dependency('sdeventplus')
George Liu4b062012020-10-13 15:26:58 +080033
George Liu4b062012020-10-13 15:26:58 +080034prog_python = find_program('python3', required: true)
35realpath_prog = find_program('realpath')
36
George Liu4b062012020-10-13 15:26:58 +080037
Patrick Williams7217c032022-03-16 16:26:09 -050038if cpp.has_header('CLI/CLI.hpp')
39 CLI11_dep = declare_dependency()
40else
Patrick Williamsa821dea2022-03-21 09:43:07 -050041 CLI11_dep = dependency('CLI11')
Patrick Williams7217c032022-03-16 16:26:09 -050042endif
43
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050044# 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()
Konstantin Aladysheve1303412024-04-02 18:19:09 +030053 cereal_opts.add_cmake_defines({'BUILD_TESTS': 'OFF', 'SKIP_PERFORMANCE_COMPARISON': 'ON'})
Patrick Williamsd1c1f0e2022-03-16 10:46:47 -050054 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
George Liu4b062012020-10-13 15:26:58 +080062deps = [
Patrick Williams7217c032022-03-16 16:26:09 -050063 CLI11_dep,
64 cereal_dep,
65 nlohmann_json_dep,
66 phosphor_dbus_interfaces_dep,
67 phosphor_logging_dep,
George Liu4b062012020-10-13 15:26:58 +080068 sdbusplus_dep,
George Liu687fe072021-05-04 16:16:43 +080069 sdeventplus_dep,
George Liu4b062012020-10-13 15:26:58 +080070]
71
Patrick Williams953315d2022-03-16 14:30:39 -050072subdir('manager')
73subdir('fault-monitor')
George Liu4b062012020-10-13 15:26:58 +080074
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
George Liu049700c2023-08-07 17:28:30 +080084if get_option('tests').allowed()
George Liu4b062012020-10-13 15:26:58 +080085 subdir('test')
86endif
George Liu629f4a32021-04-14 17:42:08 +080087
88install_subdir('configs',
89 install_dir: get_option('datadir') / 'phosphor-led-manager',
90 strip_directory: true)