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('POWER_DBUS_OBJECT_NAME', 14 '/xyz/openbmc_project/Chassis/Buttons/Power0') 15conf_data.set_quoted('RESET_DBUS_OBJECT_NAME', 16 '/xyz/openbmc_project/Chassis/Buttons/Reset0') 17conf_data.set_quoted('ID_DBUS_OBJECT_NAME', 18 '/xyz/openbmc_project/Chassis/Buttons/ID0') 19conf_data.set_quoted('HS_DBUS_OBJECT_NAME', 20 '/xyz/openbmc_project/Chassis/Buttons/HostSelector') 21conf_data.set_quoted('DBG_HS_DBUS_OBJECT_NAME', 22 '/xyz/openbmc_project/Chassis/Buttons/DebugHostSelector') 23conf_data.set_quoted('SERIAL_CONSOLE_MUX_DBUS_OBJECT_NAME', 24 '/xyz/openbmc_project/Chassis/Buttons/SerialUartMux') 25conf_data.set_quoted('GPIO_BASE_LABEL_NAME', '1e780000.gpio') 26conf_data.set_quoted('CHASSIS_STATE_OBJECT_NAME', 27 '/xyz/openbmc_project/state/chassis') 28conf_data.set_quoted('CHASSISSYSTEM_STATE_OBJECT_NAME', 29 '/xyz/openbmc_project/state/chassis_system') 30conf_data.set_quoted('HOST_STATE_OBJECT_NAME', 31 '/xyz/openbmc_project/state/host') 32conf_data.set_quoted('ID_LED_GROUP', get_option('id-led-group')) 33 34conf_data.set_quoted('POWER_BUTTON_PROFILE', get_option('power-button-profile')) 35 36conf_data.set('LONG_PRESS_TIME_MS', get_option('long-press-time-ms')) 37conf_data.set('LOOKUP_GPIO_BASE', get_option('lookup-gpio-base').allowed()) 38conf_data.set('ENABLE_RESET_BUTTON_DO_WARM_REBOOT', get_option('reset-button-do-warm-reboot').allowed()) 39 40configure_file(output: 'config.h', 41 configuration: conf_data 42) 43 44gpioplus_dep = dependency('gpioplus') 45nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 46phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 47phosphor_logging_dep = dependency('phosphor-logging') 48sdbusplus_dep = dependency('sdbusplus') 49sdeventplus_dep = dependency('sdeventplus') 50 51deps = [ 52 sdbusplus_dep, 53 phosphor_dbus_interfaces_dep, 54 phosphor_logging_dep, 55 nlohmann_json_dep, 56 gpioplus_dep, 57 sdeventplus_dep, 58] 59 60sources_buttons = [ 61 'src/gpio.cpp', 62 'src/cpld.cpp', 63 'src/hostSelector_switch.cpp', 64 'src/debugHostSelector_button.cpp', 65 'src/serial_uart_mux.cpp', 66 'src/id_button.cpp', 67 'src/main.cpp', 68 'src/power_button.cpp', 69 'src/reset_button.cpp', 70] 71 72sources_handler = [ 73 'src/button_handler_main.cpp', 74 'src/button_handler.cpp', 75 'src/host_then_chassis_poweroff.cpp', 76] 77 78executable( 79 'buttons', 80 sources_buttons, 81 implicit_include_directories: true, 82 include_directories: ['inc'], 83 dependencies: deps, 84 install: true, 85 install_dir: get_option('bindir') 86) 87 88executable( 89 'button-handler', 90 sources_handler, 91 implicit_include_directories: true, 92 include_directories: ['inc'], 93 dependencies: deps, 94 install: true, 95 install_dir: get_option('bindir') 96) 97 98systemd = dependency('systemd') 99systemd_system_unit_dir = systemd.get_variable( 100 'systemdsystemunitdir', 101 pkgconfig_define: ['prefix', get_option('prefix')]) 102 103fs = import('fs') 104fs.copyfile( 105 'service_files/phosphor-button-handler.service', 106 install: true, 107 install_dir: systemd_system_unit_dir 108) 109fs.copyfile( 110 'service_files/xyz.openbmc_project.Chassis.Buttons.service', 111 install: true, 112 install_dir: systemd_system_unit_dir 113) 114