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 = ['-DBOOST_ASIO_DISABLE_THREADS', 34 '-DBOOST_ERROR_CODE_HEADER_ONLY', 35 '-DBOOST_SYSTEM_NO_DEPRECATED'] 36 37systemd_system_unit_dir = systemd.get_variable( 38 'systemdsystemunitdir', 39 pkgconfig_define: ['prefix', get_option('prefix')]) 40 41fs = import('fs') 42fs.copyfile( 43 'phosphor-gpio-monitor@.service', 44 install: true, 45 install_dir: systemd_system_unit_dir 46) 47 48fs.copyfile( 49 'phosphor-multi-gpio-monitor.service', 50 install: true, 51 install_dir: systemd_system_unit_dir 52) 53 54fs.copyfile( 55 'phosphor-multi-gpio-presence.service', 56 install: true, 57 install_dir: systemd_system_unit_dir 58) 59 60fs.copyfile( 61 'phosphor-gpio-presence@.service', 62 install: true, 63 install_dir: systemd_system_unit_dir 64) 65 66udev = dependency('udev') 67udev_rules_dir = join_paths( 68 udev.get_variable( 69 'udevdir', 70 pkgconfig_define: ['prefix', get_option('prefix')], 71 ), 72 'rules.d', 73) 74 75fs.copyfile( 76 '99-gpio-keys.rules', 77 install: true, 78 install_dir: udev_rules_dir 79) 80 81fs.copyfile( 82 'phosphor-multi-gpio-monitor.json', 83 install: true, 84 install_dir: get_option('datadir') / 'phosphor-gpio-monitor' 85) 86 87libevdev_o = static_library( 88 'libevdev_o', 89 'evdev.cpp', 90 dependencies: [ 91 libevdev, 92 phosphor_dbus_interfaces, 93 phosphor_logging, 94 sdbusplus, 95 ] 96) 97 98libmonitor_o = static_library( 99 'libmonitor_o', 100 'monitor.cpp', 101 dependencies: [ 102 libevdev, 103 libsystemd, 104 phosphor_logging, 105 ], 106 link_with: [ 107 libevdev_o, 108 ], 109) 110 111phosphor_gpio_monitor = executable( 112 'phosphor-gpio-monitor', 113 'mainapp.cpp', 114 dependencies: [ 115 cli11_dep, 116 libevdev, 117 libsystemd, 118 phosphor_logging, 119 ], 120 install: true, 121 link_with: [ 122 libevdev_o, 123 libmonitor_o, 124 ], 125) 126 127executable( 128 'phosphor-multi-gpio-monitor', 129 'gpioMonMain.cpp', 130 'gpioMon.cpp', 131 dependencies: [ 132 cli11_dep, 133 libgpiod, 134 nlohmann_json_dep, 135 phosphor_dbus_interfaces, 136 phosphor_logging, 137 sdbusplus, 138 ], 139 cpp_args: boost_args, 140 install: true, 141) 142 143subdir('presence') 144subdir('multi-presence') 145 146build_tests = get_option('tests') 147if build_tests.allowed() 148 subdir('test') 149endif 150