[Bf-blender-cvs] [ed1e4ab1bf3] wl_default: cmake: disable WITH_GHOST_WAYLAND if any Wayland dependency is missing

Christian Rauch noreply at git.blender.org
Sat Aug 14 22:29:25 CEST 2021


Commit: ed1e4ab1bf3ea4e817c8a81cdee350b9adf04986
Author: Christian Rauch
Date:   Fri Jul 30 22:03:12 2021 +0100
Branches: wl_default
https://developer.blender.org/rBed1e4ab1bf3ea4e817c8a81cdee350b9adf04986

cmake: disable WITH_GHOST_WAYLAND if any Wayland dependency is missing

This sets WITH_GHOST_WAYLAND to ON and auto-disables it again, if one of
the required Wayland development libraries is missing.

Differential Revision: D11489

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

M	CMakeLists.txt
M	build_files/cmake/platform/platform_unix.cmake
M	intern/ghost/CMakeLists.txt

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 201608a531a..ac5e977fba1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -221,7 +221,7 @@ if(UNIX AND NOT (APPLE OR HAIKU))
   option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
   mark_as_advanced(WITH_GHOST_X11)
 
-  option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
+  option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" ON)
   mark_as_advanced(WITH_GHOST_WAYLAND)
 endif()
 
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index ffdbbc3f8c5..038a9ba4dac 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -574,20 +574,55 @@ endif()
 
 if(WITH_GHOST_WAYLAND)
   find_package(PkgConfig)
-  pkg_check_modules(wayland-client REQUIRED wayland-client>=1.12)
-  pkg_check_modules(wayland-egl REQUIRED wayland-egl)
-  pkg_check_modules(wayland-scanner REQUIRED wayland-scanner)
-  pkg_check_modules(xkbcommon REQUIRED xkbcommon)
-  pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
-  pkg_check_modules(dbus REQUIRED dbus-1)
-
-  list(APPEND PLATFORM_LINKLIBS
-    ${wayland-client_LINK_LIBRARIES}
-    ${wayland-egl_LINK_LIBRARIES}
-    ${xkbcommon_LINK_LIBRARIES}
-    ${wayland-cursor_LINK_LIBRARIES}
-    ${dbus_LINK_LIBRARIES}
-  )
+  pkg_check_modules(wayland-client QUIET wayland-client>=1.12)
+  pkg_check_modules(wayland-egl QUIET wayland-egl)
+  pkg_check_modules(wayland-scanner QUIET wayland-scanner)
+  pkg_check_modules(wayland-cursor QUIET wayland-cursor)
+  pkg_check_modules(xkbcommon QUIET xkbcommon)
+  pkg_check_modules(dbus QUIET dbus-1)
+  pkg_check_modules(wayland-protocols QUIET wayland-protocols>=1.15)
+
+  if (${wayland-protocols_FOUND})
+    pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+  else()
+    find_path(WAYLAND_PROTOCOLS_DIR
+      NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
+      PATH_SUFFIXES share/wayland-protocols
+    )
+  endif()
+
+  if(NOT wayland-client_FOUND)
+    message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT wayland-egl_FOUND)
+    message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT wayland-scanner_FOUND)
+    message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT wayland-cursor_FOUND)
+    message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT xkbcommon_FOUND)
+    message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT dbus_FOUND)
+    message(STATUS "dbus not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  elseif(NOT EXISTS ${WAYLAND_PROTOCOLS_DIR})
+    message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND")
+    set(WITH_GHOST_WAYLAND OFF)
+  endif()
+
+  if(WITH_GHOST_WAYLAND)
+    list(APPEND PLATFORM_LINKLIBS
+      ${wayland-client_LINK_LIBRARIES}
+      ${wayland-egl_LINK_LIBRARIES}
+      ${xkbcommon_LINK_LIBRARIES}
+      ${wayland-cursor_LINK_LIBRARIES}
+      ${dbus_LINK_LIBRARIES}
+    )
+  endif()
 endif()
 
 if(WITH_GHOST_X11)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 76cac1049fb..83686fe9cc0 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -306,20 +306,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
 
     pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
 
-    pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
-    if (${wayland-protocols_FOUND})
-      pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
-    else()
-      find_path(WAYLAND_PROTOCOLS_DIR
-        NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
-        PATH_SUFFIXES share/wayland-protocols
-      )
-    endif()
-
-    if (NOT EXISTS ${WAYLAND_PROTOCOLS_DIR})
-      message(FATAL_ERROR "path to wayland-protocols not found")
-    endif()
-
     # Generate protocols bindings.
     macro(generate_protocol_bindings NAME PROT_DEF)
       add_custom_command(



More information about the Bf-blender-cvs mailing list