meson: Add optional libsystemd dependency

To utilize the API provided by libsystemd it would be better to
create a separate HAVE_LIBSYSTEMD configuration option instead of
having to rely on HAVE_NATIVE_BACKEND.

For now this will be utilized for getting the control group of a
MetaWindow.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1960>
This commit is contained in:
Nishal Kulkarni 2021-08-05 19:37:28 +05:30 committed by Florian Müllner
parent 5ffd77c36b
commit 4a0c86ea4c
4 changed files with 19 additions and 1 deletions

View File

@ -34,6 +34,9 @@
/* Building with libwacom for advanced tablet management */ /* Building with libwacom for advanced tablet management */
#mesondefine HAVE_LIBWACOM #mesondefine HAVE_LIBWACOM
/* Building with libsystemd */
#mesondefine HAVE_LIBSYSTEMD
/* Define if you want to enable the native (KMS) backend based on systemd */ /* Define if you want to enable the native (KMS) backend based on systemd */
#mesondefine HAVE_NATIVE_BACKEND #mesondefine HAVE_NATIVE_BACKEND

View File

@ -191,13 +191,15 @@ if have_libgudev
endif endif
endif endif
have_libsystemd = get_option('systemd')
libsystemd_dep = dependency('libsystemd', required: have_libsystemd)
have_native_backend = get_option('native_backend') have_native_backend = get_option('native_backend')
if have_native_backend if have_native_backend
libdrm_dep = dependency('libdrm') libdrm_dep = dependency('libdrm')
libgbm_dep = dependency('gbm', version: gbm_req) libgbm_dep = dependency('gbm', version: gbm_req)
libinput_dep = dependency('libinput', version: libinput_req) libinput_dep = dependency('libinput', version: libinput_req)
libsystemd_dep = dependency('libsystemd', required: false)
if libsystemd_dep.found() if libsystemd_dep.found()
logind_provider_dep = libsystemd_dep logind_provider_dep = libsystemd_dep
else else
@ -389,6 +391,7 @@ cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set('HAVE_EGL', have_egl) cdata.set('HAVE_EGL', have_egl)
cdata.set('HAVE_WAYLAND', have_wayland) cdata.set('HAVE_WAYLAND', have_wayland)
cdata.set('HAVE_LIBSYSTEMD', have_libsystemd)
cdata.set('HAVE_NATIVE_BACKEND', have_native_backend) cdata.set('HAVE_NATIVE_BACKEND', have_native_backend)
cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop) cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop)
cdata.set('HAVE_EGL_DEVICE', have_egl_device) cdata.set('HAVE_EGL_DEVICE', have_egl_device)

View File

@ -39,6 +39,12 @@ option('wayland',
description: 'Enable Wayland support' description: 'Enable Wayland support'
) )
option('systemd',
type: 'boolean',
value: true,
description: 'Enable systemd support'
)
option('native_backend', option('native_backend',
type: 'boolean', type: 'boolean',
value: true, value: true,

View File

@ -118,6 +118,12 @@ if have_wayland
] ]
endif endif
if have_libsystemd
mutter_pkg_private_deps += [
libsystemd_dep,
]
endif
if have_native_backend if have_native_backend
mutter_pkg_private_deps += [ mutter_pkg_private_deps += [
libdrm_dep, libdrm_dep,