George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-ledcontroller', 'cpp', |
| 3 | version : '1.0.0', |
Patrick Williams | 2b50fa6 | 2023-07-17 10:07:11 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
Patrick Williams | 2b50fa6 | 2023-07-17 10:07:11 -0500 | [diff] [blame] | 8 | 'cpp_std=c++23', |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 9 | 'buildtype=debugoptimized' |
| 10 | ] |
| 11 | ) |
| 12 | |
George Liu | 3c89426 | 2021-12-28 10:32:49 +0800 | [diff] [blame] | 13 | sdbusplus_dep = dependency('sdbusplus') |
| 14 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
Jayashree Dhanapal | b677984 | 2022-10-07 13:34:16 +0530 | [diff] [blame] | 15 | phosphor_logging_dep = dependency('phosphor-logging') |
George Liu | eaa1c89 | 2023-08-03 16:19:51 +0800 | [diff] [blame] | 16 | |
| 17 | cxx = meson.get_compiler('cpp') |
| 18 | if cxx.has_header('CLI/CLI.hpp') |
| 19 | cli11_dep = declare_dependency() |
| 20 | else |
| 21 | cli11_dep = dependency('CLI11') |
| 22 | endif |
| 23 | |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 24 | deps = [ |
George Liu | eaa1c89 | 2023-08-03 16:19:51 +0800 | [diff] [blame] | 25 | cli11_dep, |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 26 | sdbusplus_dep, |
| 27 | phosphor_dbus_interfaces_dep, |
Jayashree Dhanapal | b677984 | 2022-10-07 13:34:16 +0530 | [diff] [blame] | 28 | phosphor_logging_dep, |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 29 | ] |
| 30 | |
Patrick Williams | 3778f8e | 2023-04-12 08:01:18 -0500 | [diff] [blame] | 31 | udevdir = dependency('udev').get_variable('udevdir') |
Andrew Jeffery | d32dd3f | 2023-02-03 11:11:04 +1030 | [diff] [blame] | 32 | install_data(['udev' / 'rules.d' / '70-leds.rules'], install_dir : udevdir / 'rules.d') |
Jayashree Dhanapal | 3930b6b | 2022-09-20 17:08:15 +0530 | [diff] [blame] | 33 | |
| 34 | systemd = dependency('systemd') |
Jayashree Dhanapal | b677984 | 2022-10-07 13:34:16 +0530 | [diff] [blame] | 35 | install_data(['systemd' / 'system' / 'phosphor-ledcontroller.service'], |
| 36 | install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir') |
| 37 | ) |
| 38 | install_data(['systemd' / 'system' / 'sysfs-led@.service'], |
| 39 | install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir') |
| 40 | ) |
| 41 | |
| 42 | dbus = dependency('dbus-1') |
| 43 | install_data(['dbus-1' / 'system-services' / 'xyz.openbmc_project.LED.Controller.service'], |
| 44 | install_dir: dbus.get_variable(pkgconfig: 'system_bus_services_dir') |
Jayashree Dhanapal | 3930b6b | 2022-09-20 17:08:15 +0530 | [diff] [blame] | 45 | ) |
| 46 | |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 47 | sources = [ |
Jayashree Dhanapal | b677984 | 2022-10-07 13:34:16 +0530 | [diff] [blame] | 48 | 'interfaces/internal_interface.cpp', |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 49 | 'controller.cpp', |
| 50 | 'physical.cpp', |
| 51 | 'sysfs.cpp', |
| 52 | ] |
| 53 | |
| 54 | executable( |
| 55 | 'phosphor-ledcontroller', |
| 56 | sources, |
| 57 | implicit_include_directories: true, |
| 58 | dependencies: deps, |
| 59 | install: true, |
Jayashree Dhanapal | 3930b6b | 2022-09-20 17:08:15 +0530 | [diff] [blame] | 60 | install_dir: '/usr/libexec/phosphor-led-sysfs' |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 61 | ) |
| 62 | |
Jayashree Dhanapal | b677984 | 2022-10-07 13:34:16 +0530 | [diff] [blame] | 63 | executable( |
| 64 | 'add-led-action', |
| 65 | 'argument.cpp', |
| 66 | 'add_led_action.cpp', |
| 67 | implicit_include_directories: true, |
| 68 | dependencies: deps, |
| 69 | install: true, |
| 70 | install_dir: '/usr/libexec/phosphor-led-sysfs' |
| 71 | ) |
| 72 | |
| 73 | build_tests = get_option('tests') |
| 74 | if build_tests.enabled() |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 75 | subdir('test') |
| 76 | endif |