blob: 34f5c2517087910fd7adc0f087c1a0b113e198a9 [file] [log] [blame]
George Liuc7d70b62021-05-17 16:02:18 +08001project(
2 'phosphor-ledcontroller', 'cpp',
3 version : '1.0.0',
Patrick Williams2b50fa62023-07-17 10:07:11 -05004 meson_version: '>=1.1.1',
George Liuc7d70b62021-05-17 16:02:18 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams2b50fa62023-07-17 10:07:11 -05008 'cpp_std=c++23',
George Liuc7d70b62021-05-17 16:02:18 +08009 'buildtype=debugoptimized'
10 ]
11)
12
George Liu3c894262021-12-28 10:32:49 +080013sdbusplus_dep = dependency('sdbusplus')
14phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
Andrew Jefferyebc30b72023-02-06 14:19:16 +103015boost = dependency('boost', include_type: 'system')
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053016phosphor_logging_dep = dependency('phosphor-logging')
George Liueaa1c892023-08-03 16:19:51 +080017
18cxx = meson.get_compiler('cpp')
19if cxx.has_header('CLI/CLI.hpp')
20 cli11_dep = declare_dependency()
21else
22 cli11_dep = dependency('CLI11')
23endif
24
George Liuc7d70b62021-05-17 16:02:18 +080025deps = [
George Liueaa1c892023-08-03 16:19:51 +080026 cli11_dep,
George Liuc7d70b62021-05-17 16:02:18 +080027 sdbusplus_dep,
28 phosphor_dbus_interfaces_dep,
Andrew Jefferyebc30b72023-02-06 14:19:16 +103029 boost,
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053030 phosphor_logging_dep,
George Liuc7d70b62021-05-17 16:02:18 +080031]
32
Patrick Williams3778f8e2023-04-12 08:01:18 -050033udevdir = dependency('udev').get_variable('udevdir')
Andrew Jefferyd32dd3f2023-02-03 11:11:04 +103034install_data(['udev' / 'rules.d' / '70-leds.rules'], install_dir : udevdir / 'rules.d')
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053035
36systemd = dependency('systemd')
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053037install_data(['systemd' / 'system' / 'phosphor-ledcontroller.service'],
38 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
39)
40install_data(['systemd' / 'system' / 'sysfs-led@.service'],
41 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
42)
43
44dbus = dependency('dbus-1')
45install_data(['dbus-1' / 'system-services' / 'xyz.openbmc_project.LED.Controller.service'],
46 install_dir: dbus.get_variable(pkgconfig: 'system_bus_services_dir')
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053047)
48
George Liuc7d70b62021-05-17 16:02:18 +080049sources = [
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053050 'interfaces/internal_interface.cpp',
George Liuc7d70b62021-05-17 16:02:18 +080051 'controller.cpp',
52 'physical.cpp',
53 'sysfs.cpp',
54]
55
56executable(
57 'phosphor-ledcontroller',
58 sources,
59 implicit_include_directories: true,
60 dependencies: deps,
61 install: true,
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053062 install_dir: '/usr/libexec/phosphor-led-sysfs'
George Liuc7d70b62021-05-17 16:02:18 +080063)
64
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053065executable(
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
75build_tests = get_option('tests')
76if build_tests.enabled()
George Liuc7d70b62021-05-17 16:02:18 +080077 subdir('test')
78endif