blob: 25d803a2cd9e64adb64e7748e31b6c49d7fb2954 [file] [log] [blame]
George Liud6a1bae2022-06-20 13:47:31 +08001project(
2 'phosphor-buttons', 'cpp',
3 version: '1.0.0',
Patrick Williams10bc3ae2023-07-12 11:15:26 -05004 meson_version: '>=1.1.1',
George Liud6a1bae2022-06-20 13:47:31 +08005 default_options: [
6 'warning_level=3',
7 'werror=true',
Patrick Williams10bc3ae2023-07-12 11:15:26 -05008 'cpp_std=c++23',
George Liud6a1bae2022-06-20 13:47:31 +08009 ]
10)
11
12conf_data = configuration_data()
George Liud6a1bae2022-06-20 13:47:31 +080013conf_data.set_quoted('ID_LED_GROUP', get_option('id-led-group'))
Matt Spinler1a309f72023-04-04 13:12:19 -050014conf_data.set_quoted('POWER_BUTTON_PROFILE', get_option('power-button-profile'))
George Liuf756f8b2022-07-06 10:44:28 +080015conf_data.set('LONG_PRESS_TIME_MS', get_option('long-press-time-ms'))
Patrick Williams88f20382023-11-29 06:44:20 -060016conf_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())
George Liud6a1bae2022-06-20 13:47:31 +080018
Delphine CC Chiu3e30b7a2024-04-12 13:11:42 -050019configure_file(
20 input: 'meson_config.hpp.in',
21 output: 'config.hpp',
George Liud6a1bae2022-06-20 13:47:31 +080022 configuration: conf_data
23)
24
Patrick Williams7824da42023-12-07 17:24:40 -060025gpioplus_dep = dependency('gpioplus')
26nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
George Liud6a1bae2022-06-20 13:47:31 +080027phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
28phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams7824da42023-12-07 17:24:40 -060029sdbusplus_dep = dependency('sdbusplus')
30sdeventplus_dep = dependency('sdeventplus')
George Liud6a1bae2022-06-20 13:47:31 +080031
32deps = [
33 sdbusplus_dep,
34 phosphor_dbus_interfaces_dep,
35 phosphor_logging_dep,
36 nlohmann_json_dep,
37 gpioplus_dep,
Matt Spinler9479b062023-04-04 11:02:39 -050038 sdeventplus_dep,
George Liud6a1bae2022-06-20 13:47:31 +080039]
40
41sources_buttons = [
42 'src/gpio.cpp',
Delphine CC Chiuccd7db02023-02-09 14:48:53 +080043 'src/cpld.cpp',
George Liud6a1bae2022-06-20 13:47:31 +080044 'src/hostSelector_switch.cpp',
Naveen Mosesa6d4e652022-04-13 19:27:25 +053045 'src/debugHostSelector_button.cpp',
Naveen Mosesd219fa32022-07-20 00:01:46 +053046 'src/serial_uart_mux.cpp',
George Liud6a1bae2022-06-20 13:47:31 +080047 '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',
Matt Spinler1a309f72023-04-04 13:12:19 -050056 'src/host_then_chassis_poweroff.cpp',
George Liud6a1bae2022-06-20 13:47:31 +080057]
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(
Patrick Williams06b10602023-04-12 08:01:05 -050081 'systemdsystemunitdir',
George Liud6a1bae2022-06-20 13:47:31 +080082 pkgconfig_define: ['prefix', get_option('prefix')])
83
George Liu70a0dc82023-08-16 15:12:28 +080084fs = 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)