FLTK logo

[master] 615b731 - CMake+Wayland: check for presence of required software modules

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 615b731 - CMake+Wayland: check for presence of required software modules "ManoloFLTK" Nov 18, 2022  
 
commit 615b731783311af2564573a98e59739a281f8f91
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Nov 18 09:10:22 2022 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Nov 18 09:10:22 2022 +0100

    CMake+Wayland: check for presence of required software  modules
    
    Also, remove hardcoded path to wayland-protocols when
    CMake version â?¥ 3.4

 CMake/options.cmake | 17 +++++++++++++++++
 src/CMakeLists.txt  | 14 +++++++++-----
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git CMake/options.cmake CMake/options.cmake
index b56ed77..8805263 100644
--- CMake/options.cmake
+++ CMake/options.cmake
@@ -196,6 +196,16 @@ if (UNIX)
   list (APPEND FLTK_LDLIBS -lm)
   option (OPTION_USE_WAYLAND "support Wayland and X11 backends" OFF)
   if (OPTION_USE_WAYLAND)
+    pkg_check_modules(WLDCLIENT wayland-client)
+    pkg_check_modules(WLDCURSOR wayland-cursor)
+    pkg_check_modules(WLDPROTO wayland-protocols)
+    pkg_check_modules(XKBCOMMON xkbcommon)
+    pkg_check_modules(DBUS dbus-1)
+    if (NOT(DBUS_FOUND AND WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
+      message (STATUS "Not all software modules 'wayland-client wayland-cursor wayland-protocols xkbcommon dbus-1' are present")
+      message (STATUS "Consequently, building for the Wayland backend is not possible.")
+      message (FATAL_ERROR "*** Aborting ***")
+    endif (NOT(DBUS_FOUND AND WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
     option (OPTION_WAYLAND_ONLY "support Wayland backend only" OFF)
     set (FLTK_USE_WAYLAND 1)
     if (NOT OPTION_WAYLAND_ONLY)
@@ -409,6 +419,13 @@ if (HAVE_GL)
 endif (HAVE_GL)
 
 if (OPTION_USE_GL)
+  if (OPTION_USE_WAYLAND)
+    pkg_check_modules(WLDEGL wayland-egl)
+    if (NOT WLDEGL_FOUND)
+      message (STATUS "Module 'wayland-egl' is required to build for the Wayland backend.")
+      message (FATAL_ERROR "*** Aborting ***")
+    endif (NOT WLDEGL_FOUND)
+  endif (OPTION_USE_WAYLAND)
   if (OPTION_APPLE_X11)
     set (OPENGL_FOUND TRUE)
     find_library(OPENGL_LIB GL)
diff --git src/CMakeLists.txt src/CMakeLists.txt
index edb3f54..b8b773d 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -624,11 +624,15 @@ if (USE_XFT)
 endif (USE_XFT)
 
 if (UNIX AND OPTION_USE_WAYLAND)
-  if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
-    set(PROTOCOLS /usr/local/share/wayland-protocols)
-  else ()
-    set(PROTOCOLS /usr/share/wayland-protocols)
-  endif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
+  if (NOT (CMAKE_VERSION VERSION_LESS 3.4))
+    pkg_get_variable(PROTOCOLS wayland-protocols pkgdatadir) # requires cmake 3.4
+  else()
+    if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
+      set(PROTOCOLS /usr/local/share/wayland-protocols)
+    else ()
+      set(PROTOCOLS /usr/share/wayland-protocols)
+    endif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
+  endif (NOT (CMAKE_VERSION VERSION_LESS 3.4))
   add_custom_command(
     OUTPUT xdg-shell-protocol.c xdg-shell-client-protocol.h
     COMMAND wayland-scanner private-code ${PROTOCOLS}/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.c
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.