xref: /openbmc/phosphor-buttons/meson.build (revision 971312ab)
1project(
2    'phosphor-buttons', '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    ]
10)
11
12conf_data = configuration_data()
13conf_data.set_quoted('ID_LED_GROUP', get_option('id-led-group'))
14conf_data.set_quoted('POWER_BUTTON_PROFILE', get_option('power-button-profile'))
15conf_data.set('LONG_PRESS_TIME_MS', get_option('long-press-time-ms'))
16conf_data.set('LOOKUP_GPIO_BASE', get_option('lookup-gpio-base').allowed())
17conf_data.set('ENABLE_RESET_BUTTON_DO_WARM_REBOOT', get_option('reset-button-do-warm-reboot').allowed())
18
19configure_file(
20    input: 'meson_config.hpp.in',
21    output: 'config.hpp',
22    configuration: conf_data
23)
24
25gpioplus_dep = dependency('gpioplus')
26nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
27phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
28phosphor_logging_dep = dependency('phosphor-logging')
29sdbusplus_dep = dependency('sdbusplus')
30sdeventplus_dep = dependency('sdeventplus')
31
32deps = [
33    sdbusplus_dep,
34    phosphor_dbus_interfaces_dep,
35    phosphor_logging_dep,
36    nlohmann_json_dep,
37    gpioplus_dep,
38    sdeventplus_dep,
39]
40
41sources_buttons = [
42    'src/gpio.cpp',
43    'src/cpld.cpp',
44    'src/hostSelector_switch.cpp',
45    'src/debugHostSelector_button.cpp',
46    'src/serial_uart_mux.cpp',
47    'src/id_button.cpp',
48    'src/main.cpp',
49    'src/power_button.cpp',
50    'src/reset_button.cpp',
51]
52
53sources_handler = [
54    'src/button_handler_main.cpp',
55    'src/button_handler.cpp',
56    'src/host_then_chassis_poweroff.cpp',
57]
58
59executable(
60    'buttons',
61    sources_buttons,
62    implicit_include_directories: true,
63    include_directories: ['inc'],
64    dependencies: deps,
65    install: true,
66    install_dir: get_option('bindir')
67)
68
69executable(
70    'button-handler',
71    sources_handler,
72    implicit_include_directories: true,
73    include_directories: ['inc'],
74    dependencies: deps,
75    install: true,
76    install_dir: get_option('bindir')
77)
78
79systemd = dependency('systemd')
80systemd_system_unit_dir = systemd.get_variable(
81        'systemdsystemunitdir',
82        pkgconfig_define: ['prefix', get_option('prefix')])
83
84fs = import('fs')
85fs.copyfile(
86    'service_files/phosphor-button-handler.service',
87    install: true,
88    install_dir: systemd_system_unit_dir
89)
90fs.copyfile(
91    'service_files/xyz.openbmc_project.Chassis.Buttons.service',
92    install: true,
93    install_dir: systemd_system_unit_dir
94)
95