1project( 2 'phosphor-gpio-monitor', 3 'cpp', 4 default_options: [ 5 'warning_level=3', 6 'werror=true', 7 'cpp_std=c++23', 8 'buildtype=debugoptimized', 9 ], 10 license: 'Apache-2.0', 11 version: '1.0', 12 meson_version: '>=1.1.1', 13) 14 15cxx = meson.get_compiler('cpp') 16 17libevdev = dependency('libevdev') 18libsystemd = dependency('libsystemd') 19libgpiod = dependency('libgpiod') 20phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces') 21phosphor_logging = dependency('phosphor-logging') 22sdbusplus = dependency('sdbusplus') 23systemd = dependency('systemd') 24 25nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 26 27if cxx.has_header('CLI/CLI.hpp') 28 cli11_dep = declare_dependency() 29else 30 cli11_dep = dependency('CLI11') 31endif 32 33boost_args = [ 34 '-DBOOST_ASIO_DISABLE_THREADS', 35 '-DBOOST_ERROR_CODE_HEADER_ONLY', 36 '-DBOOST_SYSTEM_NO_DEPRECATED', 37] 38 39boost_dep = dependency('boost') 40 41systemd_system_unit_dir = systemd.get_variable( 42 'systemd_system_unit_dir', 43 pkgconfig_define: ['prefix', get_option('prefix')], 44) 45 46fs = import('fs') 47fs.copyfile( 48 'phosphor-gpio-monitor@.service', 49 install: true, 50 install_dir: systemd_system_unit_dir, 51) 52 53fs.copyfile( 54 'phosphor-multi-gpio-monitor.service', 55 install: true, 56 install_dir: systemd_system_unit_dir, 57) 58 59fs.copyfile( 60 'phosphor-multi-gpio-presence.service', 61 install: true, 62 install_dir: systemd_system_unit_dir, 63) 64 65fs.copyfile( 66 'phosphor-gpio-presence@.service', 67 install: true, 68 install_dir: systemd_system_unit_dir, 69) 70 71udev = dependency('udev') 72udev_rules_dir = join_paths( 73 udev.get_variable( 74 'udevdir', 75 pkgconfig_define: ['prefix', get_option('prefix')], 76 ), 77 'rules.d', 78) 79 80fs.copyfile('99-gpio-keys.rules', install: true, install_dir: udev_rules_dir) 81 82fs.copyfile( 83 'phosphor-multi-gpio-monitor.json', 84 install: true, 85 install_dir: get_option('datadir') / 'phosphor-gpio-monitor', 86) 87 88libevdev_o = static_library( 89 'libevdev_o', 90 'evdev.cpp', 91 dependencies: [ 92 libevdev, 93 phosphor_dbus_interfaces, 94 phosphor_logging, 95 sdbusplus, 96 ], 97) 98 99libmonitor_o = static_library( 100 'libmonitor_o', 101 'monitor.cpp', 102 dependencies: [libevdev, libsystemd, phosphor_logging], 103 link_with: [libevdev_o], 104) 105 106phosphor_gpio_monitor = executable( 107 'phosphor-gpio-monitor', 108 'mainapp.cpp', 109 dependencies: [cli11_dep, libevdev, libsystemd, phosphor_logging], 110 install: true, 111 link_with: [libevdev_o, libmonitor_o], 112) 113 114executable( 115 'phosphor-multi-gpio-monitor', 116 'gpioMonMain.cpp', 117 'gpioMon.cpp', 118 dependencies: [ 119 cli11_dep, 120 libgpiod, 121 nlohmann_json_dep, 122 phosphor_dbus_interfaces, 123 phosphor_logging, 124 sdbusplus, 125 boost_dep, 126 ], 127 cpp_args: boost_args, 128 install: true, 129) 130 131subdir('presence') 132subdir('multi-presence') 133 134build_tests = get_option('tests') 135if build_tests.allowed() 136 subdir('test') 137endif 138