mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-04 06:00:30 +01:00
meson: allow selecting sd-bus library via option
Roughly based on https://github.com/swaywm/sway/commit/fdbe98512a71 Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
fe2abeda9d
commit
27ff400bc2
4 changed files with 31 additions and 6 deletions
26
meson.build
26
meson.build
|
|
@ -83,7 +83,31 @@ dep_libxkbcommon = dependency('xkbcommon', required: false)
|
|||
config_h.set10('HAVE_LIBXKBCOMMON', dep_libxkbcommon.found())
|
||||
dep_libevdev = dependency('libevdev', required: false)
|
||||
config_h.set10('HAVE_LIBEVDEV', dep_libevdev.found())
|
||||
dep_systemd = dependency(['libsystemd', 'libelogind', 'basu'], required: get_option('liboeffis'))
|
||||
|
||||
if not get_option('liboeffis').disabled()
|
||||
sd_bus_provider = get_option('sd-bus-provider')
|
||||
if sd_bus_provider == 'auto'
|
||||
message('Trying to find an sd-bus provider...')
|
||||
providers = ['libsystemd', 'libelogind', 'basu']
|
||||
foreach provider: providers
|
||||
if dependency(provider, required: false).found()
|
||||
message('Using sd-bus provider "@0@"'.format(provider))
|
||||
sd_bus_provider = provider
|
||||
break
|
||||
endif
|
||||
endforeach
|
||||
if sd_bus_provider == 'auto'
|
||||
error('Failed to find an sd-bus provider, tried @0@'.format(', '.join(providers)))
|
||||
endif
|
||||
summary({'sd-bus-provider': sd_bus_provider}, section: 'Conditional Features')
|
||||
endif
|
||||
dep_sdbus = dependency(sd_bus_provider, required: get_option('liboeffis'))
|
||||
else
|
||||
dep_sdbus = dependency('', required: false)
|
||||
endif
|
||||
config_h.set10('HAVE_LIBSYSTEMD', dep_sdbus.found() and dep_sdbus.name() == 'libsystemd')
|
||||
config_h.set10('HAVE_LIBELOGIND', dep_sdbus.found() and dep_sdbus.name() == 'libelogind')
|
||||
config_h.set10('HAVE_BASU', dep_sdbus.found() and dep_sdbus.name() == 'basu')
|
||||
|
||||
configure_file(output: 'config.h', configuration: config_h)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
option('documentation', type: 'array', value: [], choices: ['api', 'protocol'], description: 'Enable documentation builds')
|
||||
option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus library')
|
||||
option('tests', type: 'feature', value: 'auto', description: 'Enable/disable tests')
|
||||
option('liboeffis', type: 'feature', value: 'auto', description: 'Build liboeffis.so')
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#if __has_include(<systemd/sd-bus.h>)
|
||||
#if HAVE_LIBSYSTEMD
|
||||
#include <systemd/sd-bus.h>
|
||||
#elif __has_include(<elogind/sd-bus.h>)
|
||||
#elif HAVE_LIBELOGIND
|
||||
#include <elogind/sd-bus.h>
|
||||
#else
|
||||
#elif HAVE_BASU
|
||||
#include <basu/sd-bus.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -142,11 +142,11 @@ pkgconfig.generate(lib_libeis,
|
|||
libraries: lib_libeis,
|
||||
)
|
||||
|
||||
build_oeffis = dep_systemd.found()
|
||||
build_oeffis = dep_sdbus.found()
|
||||
summary({'liboeffis': build_oeffis}, section: 'Conditional Features')
|
||||
if build_oeffis
|
||||
src_liboeffis = files('liboeffis.c')
|
||||
deps_liboeffis = [dep_libutil, dep_systemd]
|
||||
deps_liboeffis = [dep_libutil, dep_sdbus]
|
||||
|
||||
lib_liboeffis = library('oeffis',
|
||||
src_liboeffis,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue