xref: /openbmc/phosphor-led-sysfs/meson.build (revision 24d124f9)
1project(
2    'phosphor-ledcontroller', 'cpp',
3    version : '1.0.0',
4    meson_version: '>=1.1.1',
5    default_options: [
6        'warning_level=3',
7        'werror=true',
8        'cpp_std=c++23',
9        'buildtype=debugoptimized'
10    ]
11)
12
13sdbusplus_dep = dependency('sdbusplus')
14phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
15boost = dependency('boost', include_type: 'system')
16phosphor_logging_dep = dependency('phosphor-logging')
17
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
25deps = [
26    cli11_dep,
27    sdbusplus_dep,
28    phosphor_dbus_interfaces_dep,
29    boost,
30    phosphor_logging_dep,
31]
32
33udevdir = dependency('udev').get_variable('udevdir')
34install_data(['udev' / 'rules.d' / '70-leds.rules'], install_dir : udevdir / 'rules.d')
35
36systemd = dependency('systemd')
37install_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')
47)
48
49sources = [
50    'interfaces/internal_interface.cpp',
51    '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,
62    install_dir: '/usr/libexec/phosphor-led-sysfs'
63)
64
65executable(
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()
77  subdir('test')
78endif
79