1project( 2 'phosphor-buttons', 'cpp', 3 version: '1.0.0', 4 meson_version: '>=0.58.0', 5 default_options: [ 6 'warning_level=3', 7 'werror=true', 8 'cpp_std=c++20', 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('LONG_PRESS_TIME_MS', get_option('long-press-time-ms')) 35conf_data.set('LOOKUP_GPIO_BASE', get_option('lookup-gpio-base').enabled()) 36 37configure_file(output: 'config.h', 38 configuration: conf_data 39) 40 41sdbusplus_dep = dependency('sdbusplus') 42phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') 43phosphor_logging_dep = dependency('phosphor-logging') 44gpioplus_dep = dependency('gpioplus') 45 46cpp = meson.get_compiler('cpp') 47if cpp.has_header_symbol( 48 'nlohmann/json.hpp', 49 'nlohmann::json::string_t', 50 required:false) 51 nlohmann_json_dep = declare_dependency() 52else 53 nlohmann_json_dep = dependency('nlohmann-json') 54endif 55 56deps = [ 57 sdbusplus_dep, 58 phosphor_dbus_interfaces_dep, 59 phosphor_logging_dep, 60 nlohmann_json_dep, 61 gpioplus_dep, 62] 63 64sources_buttons = [ 65 'src/gpio.cpp', 66 'src/cpld.cpp', 67 'src/hostSelector_switch.cpp', 68 'src/debugHostSelector_button.cpp', 69 'src/serial_uart_mux.cpp', 70 'src/id_button.cpp', 71 'src/main.cpp', 72 'src/power_button.cpp', 73 'src/reset_button.cpp', 74] 75 76sources_handler = [ 77 'src/button_handler_main.cpp', 78 'src/button_handler.cpp', 79] 80 81executable( 82 'buttons', 83 sources_buttons, 84 implicit_include_directories: true, 85 include_directories: ['inc'], 86 dependencies: deps, 87 install: true, 88 install_dir: get_option('bindir') 89) 90 91executable( 92 'button-handler', 93 sources_handler, 94 implicit_include_directories: true, 95 include_directories: ['inc'], 96 dependencies: deps, 97 install: true, 98 install_dir: get_option('bindir') 99) 100 101systemd = dependency('systemd') 102systemd_system_unit_dir = systemd.get_variable( 103 'systemdsystemunitdir', 104 pkgconfig_define: ['prefix', get_option('prefix')]) 105 106configure_file(input: 'service_files/phosphor-button-handler.service', 107 output: 'phosphor-button-handler.service', 108 copy: true, 109 install_dir: systemd_system_unit_dir) 110 111configure_file(input: 'service_files/xyz.openbmc_project.Chassis.Buttons.service', 112 output: 'xyz.openbmc_project.Chassis.Buttons.service', 113 copy: true, 114 install_dir: systemd_system_unit_dir) 115