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