From: Marius Vlad Date: Mon, 27 Sep 2021 15:23:58 +0000 (+0300) Subject: meson.build: Conditionally build with headless support X-Git-Tag: 12.90.1~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=e5016cbc47b46b86a50d9a6ca71269a62664efbe;p=src%2Fagl-compositor.git 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 Change-Id: Ie848d842ace06b21371de6f70ad18600927f8044 --- 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 #include +#ifdef HAVE_BACKEND_HEADLESS #include +#endif #ifdef HAVE_BACKEND_X11 #include #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,