aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/backend.c25
-rw-r--r--backend/drm/meson.build2
-rw-r--r--backend/libinput/meson.build19
-rw-r--r--backend/meson.build21
-rw-r--r--backend/x11/meson.build11
5 files changed, 64 insertions, 14 deletions
diff --git a/backend/backend.c b/backend/backend.c
index 8a7d69bd..dbf38214 100644
--- a/backend/backend.c
+++ b/backend/backend.c
@@ -6,10 +6,9 @@
#include <string.h>
#include <unistd.h>
#include <wayland-server-core.h>
-#include <wlr/backend/drm.h>
+
#include <wlr/backend/headless.h>
#include <wlr/backend/interface.h>
-#include <wlr/backend/libinput.h>
#include <wlr/backend/multi.h>
#include <wlr/backend/noop.h>
#include <wlr/backend/session.h>
@@ -22,6 +21,14 @@
#include "render/allocator.h"
#include "util/signal.h"
+#if WLR_HAS_DRM_BACKEND
+#include <wlr/backend/drm.h>
+#endif
+
+#if WLR_HAS_LIBINPUT_BACKEND
+#include <wlr/backend/libinput.h>
+#endif
+
#if WLR_HAS_X11_BACKEND
#include <wlr/backend/x11.h>
#endif
@@ -211,6 +218,7 @@ static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
return backend;
}
+#if WLR_HAS_DRM_BACKEND
static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
struct wlr_backend *backend, struct wlr_session *session) {
struct wlr_device *gpus[8];
@@ -240,6 +248,7 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
return primary_drm;
}
+#endif
static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
struct wlr_backend *backend, struct wlr_session **session,
@@ -265,9 +274,17 @@ static struct wlr_backend *attempt_backend_by_name(struct wl_display *display,
}
if (strcmp(name, "libinput") == 0) {
+#if WLR_HAS_LIBINPUT_BACKEND
return wlr_libinput_backend_create(display, *session);
+#else
+ return NULL;
+#endif
} else {
+#if WLR_HAS_DRM_BACKEND
return attempt_drm_backend(display, backend, *session);
+#else
+ return NULL;
+#endif
}
}
@@ -355,6 +372,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
return NULL;
}
+#if WLR_HAS_LIBINPUT_BACKEND
struct wlr_backend *libinput = wlr_libinput_backend_create(display,
multi->session);
if (!libinput) {
@@ -364,7 +382,9 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
return NULL;
}
wlr_multi_backend_add(backend, libinput);
+#endif
+#if WLR_HAS_DRM_BACKEND
struct wlr_backend *primary_drm =
attempt_drm_backend(display, backend, multi->session);
if (!primary_drm) {
@@ -376,6 +396,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) {
}
return backend;
+#endif
error:
wlr_backend_destroy(backend);
diff --git a/backend/drm/meson.build b/backend/drm/meson.build
index ffddfdfc..b076b472 100644
--- a/backend/drm/meson.build
+++ b/backend/drm/meson.build
@@ -8,3 +8,5 @@ wlr_files += files(
'renderer.c',
'util.c',
)
+
+features += { 'drm-backend': true }
diff --git a/backend/libinput/meson.build b/backend/libinput/meson.build
index ff78d2f8..44bb57e1 100644
--- a/backend/libinput/meson.build
+++ b/backend/libinput/meson.build
@@ -1,3 +1,19 @@
+msg = ['Required for libinput backend support.']
+if 'libinput' in backends
+ msg += 'Install "libinput" or disable the libinput backend.'
+endif
+
+libinput = dependency(
+ 'libinput',
+ version: '>=1.14.0',
+ required: 'libinput' in backends,
+ not_found_message: '\n'.join(msg),
+)
+
+if not libinput.found()
+ subdir_done()
+endif
+
wlr_files += files(
'backend.c',
'events.c',
@@ -8,3 +24,6 @@ wlr_files += files(
'tablet_tool.c',
'touch.c',
)
+
+features += { 'libinput-backend': true }
+wlr_deps += libinput
diff --git a/backend/meson.build b/backend/meson.build
index 3cd24b39..7fffc839 100644
--- a/backend/meson.build
+++ b/backend/meson.build
@@ -1,11 +1,22 @@
wlr_files += files('backend.c')
-subdir('drm')
-subdir('headless')
-subdir('libinput')
+all_backends = ['drm', 'libinput', 'x11']
+backends = get_option('backends')
+if 'auto' in backends and get_option('auto_features').enabled()
+ backends = all_backends
+elif 'auto' in backends and get_option('auto_features').disabled()
+ backends = []
+endif
+
+foreach backend : all_backends
+ if backend in backends or 'auto' in backends
+ subdir(backend)
+ endif
+endforeach
+
subdir('multi')
-subdir('noop')
subdir('wayland')
-subdir('x11')
+subdir('noop')
+subdir('headless')
subdir('session')
diff --git a/backend/x11/meson.build b/backend/x11/meson.build
index 0c6ea73b..97b6d540 100644
--- a/backend/x11/meson.build
+++ b/backend/x11/meson.build
@@ -10,17 +10,14 @@ x11_required = [
'xcb-xinput',
]
-msg = []
-if get_option('x11-backend').enabled()
- msg += 'Install "@0@" or pass "-Dx11-backend=disabled" to disable it.'
-endif
-if not get_option('x11-backend').disabled()
- msg += 'Required for X11 backend support.'
+msg = ['Required for X11 backend support.']
+if 'x11' in backends
+ msg += 'Install "@0@" or disable the X11 backend.'
endif
foreach lib : x11_required
dep = dependency(lib,
- required: get_option('x11-backend'),
+ required: 'x11' in backends,
not_found_message: '\n'.join(msg).format(lib),
)
if not dep.found()