[Bf-blender-cvs] [d779792977d] master: Build: reference bundled wayland and libdecor headers

Campbell Barton noreply at git.blender.org
Fri Oct 7 23:04:28 CEST 2022


Commit: d779792977d3b6bd941eb5359cb9d982b1d22458
Author: Campbell Barton
Date:   Sat Oct 8 07:57:14 2022 +1100
Branches: master
https://developer.blender.org/rBd779792977d3b6bd941eb5359cb9d982b1d22458

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.

===================================================================

M	build_files/cmake/platform/platform_unix.cmake

===================================================================

diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 0aab46b1250..0b137ae93d6 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -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)



More information about the Bf-blender-cvs mailing list