mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 06: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
|
||||
|
||||
#include <wayland-client.h>
|
||||
#ifdef HAVE_SYSTEMD
|
||||
#ifdef HAVE_LIBSYSTEMD
|
||||
#include <systemd/sd-bus.h>
|
||||
#elif HAVE_ELOGIND
|
||||
#elif HAVE_LIBELOGIND
|
||||
#include <elogind/sd-bus.h>
|
||||
#endif
|
||||
|
||||
|
|
25
meson.build
25
meson.build
|
@ -3,7 +3,7 @@ project(
|
|||
'c',
|
||||
version: '0.1.0',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.47.0',
|
||||
meson_version: '>=0.50.0',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=2',
|
||||
|
@ -27,13 +27,24 @@ pipewire = dependency('libpipewire-0.3', version: '>= 0.3.2')
|
|||
wayland_client = dependency('wayland-client')
|
||||
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
|
||||
|
||||
logind = dependency('libsystemd', required: false)
|
||||
if logind.found()
|
||||
add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')
|
||||
if get_option('sd-bus-provider') == 'auto'
|
||||
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
||||
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
|
||||
logind = dependency('libelogind')
|
||||
add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
|
||||
sdbus = dependency(get_option('sd-bus-provider'))
|
||||
endif
|
||||
add_project_arguments('-DHAVE_' + sdbus.name().to_upper() + '=1', language: 'c')
|
||||
|
||||
subdir('protocols')
|
||||
|
||||
|
@ -53,7 +64,7 @@ executable(
|
|||
dependencies: [
|
||||
wayland_client,
|
||||
wlr_protos,
|
||||
logind,
|
||||
sdbus,
|
||||
pipewire,
|
||||
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')
|
||||
|
|
Loading…
Reference in a new issue