mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 14:35:57 +01:00
build: introduce sd-bus-provider option
Based on https://github.com/emersion/mako/commit/67f2ed1862a9
This commit is contained in:
parent
727f13f34d
commit
7b7d927cae
3 changed files with 21 additions and 9 deletions
|
@ -2,9 +2,9 @@
|
||||||
#define XDPW_H
|
#define XDPW_H
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#ifdef HAVE_SYSTEMD
|
#ifdef HAVE_LIBSYSTEMD
|
||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#elif HAVE_ELOGIND
|
#elif HAVE_LIBELOGIND
|
||||||
#include <elogind/sd-bus.h>
|
#include <elogind/sd-bus.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
25
meson.build
25
meson.build
|
@ -3,7 +3,7 @@ project(
|
||||||
'c',
|
'c',
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.47.0',
|
meson_version: '>=0.50.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
|
@ -27,13 +27,24 @@ pipewire = dependency('libpipewire-0.3', version: '>= 0.3.2')
|
||||||
wayland_client = dependency('wayland-client')
|
wayland_client = dependency('wayland-client')
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
||||||
|
|
||||||
logind = dependency('libsystemd', required: false)
|
if get_option('sd-bus-provider') == 'auto'
|
||||||
if logind.found()
|
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
||||||
add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')
|
sdbus = dependency('libsystemd',
|
||||||
|
required: false,
|
||||||
|
not_found_message: 'libsystemd not found, trying libelogind',
|
||||||
|
)
|
||||||
|
if not sdbus.found()
|
||||||
|
sdbus = dependency('libelogind',
|
||||||
|
required: false,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
if not sdbus.found()
|
||||||
|
error('Neither libsystemd, nor libelogind was found')
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
logind = dependency('libelogind')
|
sdbus = dependency(get_option('sd-bus-provider'))
|
||||||
add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
|
|
||||||
endif
|
endif
|
||||||
|
add_project_arguments('-DHAVE_' + sdbus.name().to_upper() + '=1', language: 'c')
|
||||||
|
|
||||||
subdir('protocols')
|
subdir('protocols')
|
||||||
|
|
||||||
|
@ -53,7 +64,7 @@ executable(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
wayland_client,
|
wayland_client,
|
||||||
wlr_protos,
|
wlr_protos,
|
||||||
logind,
|
sdbus,
|
||||||
pipewire,
|
pipewire,
|
||||||
rt,
|
rt,
|
||||||
],
|
],
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
|
option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind'], value: 'auto', description: 'Provider of the sd-bus library')
|
||||||
option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit')
|
option('systemd', type: 'feature', value: 'auto', description: 'Install systemd user service unit')
|
||||||
|
|
Loading…
Reference in a new issue