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') |
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, |
Andrew Jeffery | ebc30b7 | 2023-02-06 14:19:16 +1030 | [diff] [blame] | 28 | boost, |
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') |
Andrew Jeffery | 97ca787 | 2023-02-07 10:52:42 +1030 | [diff] [blame] | 35 | install_data(['systemd' / 'system' / 'xyz.openbmc_project.led.controller@.service'], |
Patrick Williams | 3778f8e | 2023-04-12 08:01:18 -0500 | [diff] [blame] | 36 | install_dir: systemd.get_variable('systemdsystemunitdir') |
Jayashree Dhanapal | 3930b6b | 2022-09-20 17:08:15 +0530 | [diff] [blame] | 37 | ) |
| 38 | |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 39 | sources = [ |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 40 | 'controller.cpp', |
| 41 | 'physical.cpp', |
| 42 | 'sysfs.cpp', |
| 43 | ] |
| 44 | |
| 45 | executable( |
| 46 | 'phosphor-ledcontroller', |
| 47 | sources, |
| 48 | implicit_include_directories: true, |
| 49 | dependencies: deps, |
| 50 | install: true, |
Jayashree Dhanapal | 3930b6b | 2022-09-20 17:08:15 +0530 | [diff] [blame] | 51 | install_dir: '/usr/libexec/phosphor-led-sysfs' |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 52 | ) |
| 53 | |
George Liu | f4eb29d | 2023-08-07 19:49:21 +0800 | [diff] [blame] | 54 | if get_option('tests').allowed() |
George Liu | c7d70b6 | 2021-05-17 16:02:18 +0800 | [diff] [blame] | 55 | subdir('test') |
| 56 | endif |