blob: 8fc1ac7a7a3134e390518145711ad232082092b2 [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')
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053015phosphor_logging_dep = dependency('phosphor-logging')
George Liueaa1c892023-08-03 16:19:51 +080016
17cxx = meson.get_compiler('cpp')
18if cxx.has_header('CLI/CLI.hpp')
19 cli11_dep = declare_dependency()
20else
21 cli11_dep = dependency('CLI11')
22endif
23
George Liuc7d70b62021-05-17 16:02:18 +080024deps = [
George Liueaa1c892023-08-03 16:19:51 +080025 cli11_dep,
George Liuc7d70b62021-05-17 16:02:18 +080026 sdbusplus_dep,
27 phosphor_dbus_interfaces_dep,
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053028 phosphor_logging_dep,
George Liuc7d70b62021-05-17 16:02:18 +080029]
30
Patrick Williams3778f8e2023-04-12 08:01:18 -050031udevdir = dependency('udev').get_variable('udevdir')
Andrew Jefferyd32dd3f2023-02-03 11:11:04 +103032install_data(['udev' / 'rules.d' / '70-leds.rules'], install_dir : udevdir / 'rules.d')
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053033
34systemd = dependency('systemd')
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053035install_data(['systemd' / 'system' / 'phosphor-ledcontroller.service'],
36 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
37)
38install_data(['systemd' / 'system' / 'sysfs-led@.service'],
39 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
40)
41
42dbus = dependency('dbus-1')
43install_data(['dbus-1' / 'system-services' / 'xyz.openbmc_project.LED.Controller.service'],
44 install_dir: dbus.get_variable(pkgconfig: 'system_bus_services_dir')
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053045)
46
George Liuc7d70b62021-05-17 16:02:18 +080047sources = [
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053048 'interfaces/internal_interface.cpp',
George Liuc7d70b62021-05-17 16:02:18 +080049 'controller.cpp',
50 'physical.cpp',
51 'sysfs.cpp',
52]
53
54executable(
55 'phosphor-ledcontroller',
56 sources,
57 implicit_include_directories: true,
58 dependencies: deps,
59 install: true,
Jayashree Dhanapal3930b6b2022-09-20 17:08:15 +053060 install_dir: '/usr/libexec/phosphor-led-sysfs'
George Liuc7d70b62021-05-17 16:02:18 +080061)
62
Jayashree Dhanapalb6779842022-10-07 13:34:16 +053063executable(
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
73build_tests = get_option('tests')
74if build_tests.enabled()
George Liuc7d70b62021-05-17 16:02:18 +080075 subdir('test')
76endif