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