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