summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2021-09-27 18:23:58 +0300
committerMarius Vlad <marius.vlad@collabora.com>2021-09-28 00:14:44 +0300
commite5016cbc47b46b86a50d9a6ca71269a62664efbe (patch)
treeaacf59489227e3ea54cc199acf953aaca50767c4
parentd6f64b665a39e0bde2fe5d5b79a0274f734b2c6e (diff)
meson.build: Conditionally build with headless support
This allow to build the compositor without headless support, just in case libweston wasn't built with it. Bug-AGL: SPEC-4087 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: Ie848d842ace06b21371de6f70ad18600927f8044
-rw-r--r--meson.build9
-rw-r--r--src/compositor.c10
2 files changed, 19 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index f8e97a5..d953fe3 100644
--- a/meson.build
+++ b/meson.build
@@ -203,17 +203,26 @@ if libweston_dep.found()
if not meson.is_cross_build()
if not prefix_path.contains('/usr')
dir_path_x11_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_headless_backend = join_paths(prefix_path, 'include', libweston_version, 'libweston', 'backend-headless.h')
else
dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
endif
else
message('Building with cross environment')
dir_path_x11_backend = join_paths(libweston_version, 'libweston', 'backend-x11.h')
+ dir_path_headless_backend = join_paths(libweston_version, 'libweston', 'backend-headless.h')
endif
# do the test
if cc.has_header(dir_path_x11_backend)
config_h.set('HAVE_BACKEND_X11', 1)
+ message('Building with X11 backend')
+ endif
+
+ if cc.has_header(dir_path_headless_backend)
+ config_h.set('HAVE_BACKEND_HEADLESS', 1)
+ message('Building with headless backend')
endif
endif
diff --git a/src/compositor.c b/src/compositor.c
index c8f9e60..926cb2c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -39,7 +39,9 @@
#include <libweston/backend-drm.h>
#include <libweston/backend-wayland.h>
+#ifdef HAVE_BACKEND_HEADLESS
#include <libweston/backend-headless.h>
+#endif
#ifdef HAVE_BACKEND_X11
#include <libweston/backend-x11.h>
#endif
@@ -1087,6 +1089,7 @@ load_x11_backend(struct ivi_compositor *ivi, int *argc, char *argv[])
}
#endif
+#ifdef HAVE_BACKEND_HEADLESS
static int
load_headless_backend(struct ivi_compositor *ivi, int *argc, char **argv)
{
@@ -1134,6 +1137,13 @@ load_headless_backend(struct ivi_compositor *ivi, int *argc, char **argv)
return 0;
}
+#else
+static int
+load_headless_backend(struct ivi_compositor *ivi, int *argc, char **argv)
+{
+ return -1;
+}
+#endif
static int
load_backend(struct ivi_compositor *ivi, const char *backend,