build: simplify dep_egl a bit

Make sure dep_egl is always a valid dependency object, even if not
found. Ensure it is not found when not wanted, to avoid linking when
found but not wanted.

Using a not-found dependency in Meson is defined to be a safe no-op, so
use that to simplify the backend dependencies.

libweston/meson.build already errors out if renderer-gl is enabled and
EGL is not found, so the same checks can be removed from the backends.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2022-12-08 17:19:34 +02:00 committed by Pekka Paalanen
parent 2667829746
commit 915d8e8cdf
3 changed files with 4 additions and 11 deletions

View File

@ -33,6 +33,7 @@ srcs_drm = [
]
deps_drm = [
dep_egl, # optional
dep_libm,
dep_libdl,
dep_libweston_private,
@ -55,10 +56,6 @@ if get_option('renderer-gl')
config_h.set('HAVE_GBM_FD_IMPORT', '1')
endif
deps_drm += dep_gbm
if not dep_egl.found()
error('drm-backend + gl-renderer requires egl which was not found. Or, you can use \'-Dbackend-drm=false\' or \'-Drenderer-gl=false\'.')
endif
deps_drm += dep_egl
srcs_drm += 'drm-gbm.c'
config_h.set('BUILD_DRM_GBM', '1')
endif

View File

@ -16,6 +16,7 @@ if not dep_x11_xcb.found()
endif
deps_x11 = [
dep_egl, # optional
dep_libweston_private,
dep_libdrm_headers,
dep_x11_xcb,
@ -37,13 +38,6 @@ if dep_xcb_xkb.found()
config_h.set('HAVE_XCB_XKB', '1')
endif
if get_option('renderer-gl')
if not dep_egl.found()
error('x11-backend + gl-renderer requires egl which was not found. Or, you can use \'-Dbackend-x11=false\' or \'-Drenderer-gl=false\'.')
endif
deps_x11 += dep_egl
endif
plugin_x11 = shared_library(
'x11-backend',
srcs_x11,

View File

@ -81,6 +81,8 @@ if get_option('renderer-gl')
error('libweston + gl-renderer requires egl which was not found. Or, you can use \'-Drenderer-gl=false\'.')
endif
deps_libweston += dep_egl
else
dep_egl = dependency('', required: false)
endif
if get_option('backend-vnc')