Build: reference bundled wayland and libdecor headers

When using pre-compiled libs, reference the bundled wayland headers,
needed so the headers from the bundled wayland-scanner are compatible.

Part of D16091.
This commit is contained in:
Campbell Barton 2022-10-08 07:57:14 +11:00
parent 66f184d981
commit d779792977
1 changed files with 31 additions and 7 deletions

View File

@ -699,14 +699,23 @@ endif()
if(WITH_GHOST_WAYLAND)
find_package(PkgConfig)
pkg_check_modules(wayland-client wayland-client>=1.12)
pkg_check_modules(wayland-egl wayland-egl)
pkg_check_modules(wayland-scanner wayland-scanner)
pkg_check_modules(xkbcommon xkbcommon)
pkg_check_modules(wayland-cursor wayland-cursor)
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
if(${wayland-protocols_FOUND})
# When dynamically linked WAYLAND is used and `${LIBDIR}/wayland` is present,
# there is no need to search for the libraries as they are not needed for building.
# Only the headers are needed which can reference the known paths.
if(EXISTS "${LIBDIR}/wayland" AND WITH_GHOST_WAYLAND_DYNLOAD)
set(_use_system_wayland OFF)
else()
set(_use_system_wayland ON)
endif()
if(_use_system_wayland)
pkg_check_modules(wayland-client wayland-client>=1.12)
pkg_check_modules(wayland-egl wayland-egl)
pkg_check_modules(wayland-scanner wayland-scanner)
pkg_check_modules(wayland-cursor wayland-cursor)
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
else()
# CentOS 7 packages have too old a version, a newer version exist in the
@ -720,6 +729,15 @@ if(WITH_GHOST_WAYLAND)
if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
set(wayland-protocols_FOUND ON)
endif()
set(wayland-client_INCLUDE_DIRS "${LIBDIR}/wayland/include")
set(wayland-egl_INCLUDE_DIRS "${LIBDIR}/wayland/include")
set(wayland-cursor_INCLUDE_DIRS "${LIBDIR}/wayland/include")
set(wayland-client_FOUND ON)
set(wayland-egl_FOUND ON)
set(wayland-scanner_FOUND ON)
set(wayland-cursor_FOUND ON)
endif()
if (NOT ${wayland-client_FOUND})
@ -753,7 +771,11 @@ if(WITH_GHOST_WAYLAND)
endif()
if(WITH_GHOST_WAYLAND_LIBDECOR)
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
if(_use_system_wayland)
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
else()
set(libdecor_INCLUDE_DIRS "${LIBDIR}/wayland_libdecor/include/libdecor-0")
endif()
endif()
list(APPEND PLATFORM_LINKLIBS
@ -823,6 +845,8 @@ if(WITH_GHOST_WAYLAND)
# End wayland-scanner version check.
endif()
unset(_use_system_wayland)
endif()
if(WITH_GHOST_X11)