summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-03-04 15:40:29 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-03-04 15:41:00 +0100
commit3718effc431f5622a23c55b254153efdfe4e72c4 (patch)
treed8a805870c6a3785022e2f52f0c3715410e29a37 /CMake
parenta773fdc44bfb818f1830e9e48ba765881e68c942 (diff)
Add the Wayland platform to FLTK 1.4
Diffstat (limited to 'CMake')
-rw-r--r--CMake/options.cmake40
-rw-r--r--CMake/variables.cmake5
2 files changed, 39 insertions, 6 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake
index eb8f1fe92..602663fe6 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -50,6 +50,24 @@ set (FL_ABI_VERSION ${OPTION_ABI_VERSION})
if (UNIX)
option (OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
list (APPEND FLTK_LDLIBS -lm)
+ option (OPTION_USE_WAYLAND "use Wayland" OFF)
+ if (OPTION_USE_WAYLAND)
+ set (FLTK_USE_WAYLAND 1)
+ option (OPTION_USE_SYSTEM_LIBDECOR "use libdecor from the system" OFF)
+ unset (OPTION_USE_XRENDER CACHE)
+ unset (OPTION_USE_XINERAMA CACHE)
+ unset (OPTION_USE_XFT CACHE)
+ unset (OPTION_USE_XCURSOR CACHE)
+ unset (OPTION_USE_XFIXES CACHE)
+ unset (OPTION_USE_PANGO CACHE)
+ set (OPTION_USE_PANGO TRUE CACHE BOOL "use lib Pango")
+ if (OPTION_USE_SYSTEM_LIBDECOR)
+ pkg_check_modules(SYSTEM_LIBDECOR libdecor-0)
+ if (NOT SYSTEM_LIBDECOR_FOUND)
+ set (OPTION_USE_SYSTEM_LIBDECOR OFF)
+ endif (NOT SYSTEM_LIBDECOR_FOUND)
+ endif (OPTION_USE_SYSTEM_LIBDECOR)
+ endif (OPTION_USE_WAYLAND)
endif (UNIX)
if (WIN32)
@@ -72,7 +90,7 @@ endif (APPLE)
# find X11 libraries and headers
set (PATH_TO_XLIBS)
-if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
+if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32 AND NOT OPTION_USE_WAYLAND)
include (FindX11)
if (X11_FOUND)
set (FLTK_USE_X11 1)
@@ -82,7 +100,7 @@ if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
endif (X11_Xext_FOUND)
get_filename_component (PATH_TO_XLIBS ${X11_X11_LIB} PATH)
endif (X11_FOUND)
-endif ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
+endif ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32 AND NOT OPTION_USE_WAYLAND)
if (OPTION_APPLE_X11)
if (NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0)) # a.k.a. macOS version ≥ 10.13
@@ -252,6 +270,8 @@ if (OPENGL_FOUND)
set (GLLIBS "-lglu32 -lopengl32")
elseif (APPLE AND NOT OPTION_APPLE_X11)
set (GLLIBS "-framework OpenGL")
+ elseif (OPTION_USE_WAYLAND)
+ set (GLLIBS "-lwayland-egl -lEGL -lGLU -lGL")
else ()
set (GLLIBS "-lGLU -lGL")
endif (WIN32)
@@ -481,7 +501,7 @@ if (X11_Xft_FOUND)
endif (X11_Xft_FOUND)
# test option compatibility: Pango requires Xft
-if (OPTION_USE_PANGO)
+if (OPTION_USE_PANGO AND NOT OPTION_USE_WAYLAND)
if (NOT X11_Xft_FOUND)
message (STATUS "Pango requires Xft but Xft library or headers could not be found.")
message (STATUS "Please install Xft development files and try again or disable OPTION_USE_PANGO.")
@@ -493,10 +513,10 @@ if (OPTION_USE_PANGO)
message (FATAL_ERROR "*** Aborting ***")
endif (NOT OPTION_USE_XFT)
endif (NOT X11_Xft_FOUND)
-endif (OPTION_USE_PANGO)
+endif (OPTION_USE_PANGO AND NOT OPTION_USE_WAYLAND)
#######################################################################
-if (X11_Xft_FOUND AND OPTION_USE_PANGO)
+if ((X11_Xft_FOUND OR OPTION_USE_WAYLAND) AND OPTION_USE_PANGO)
pkg_check_modules(PANGOXFT pangoxft)
pkg_check_modules(PANGOCAIRO pangocairo)
pkg_check_modules(CAIRO cairo)
@@ -553,7 +573,15 @@ if (X11_Xft_FOUND AND OPTION_USE_PANGO)
list (APPEND FLTK_LDLIBS -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0)
endif (HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT)
endif (PANGOXFT_FOUND AND PANGOCAIRO_FOUND AND CAIRO_FOUND)
-endif (X11_Xft_FOUND AND OPTION_USE_PANGO)
+endif ((X11_Xft_FOUND OR OPTION_USE_WAYLAND) AND OPTION_USE_PANGO)
+
+if (OPTION_USE_WAYLAND AND NOT OPTION_USE_SYSTEM_LIBDECOR)
+ pkg_check_modules(GTK gtk+-3.0)
+ #set (GTK_FOUND 0) #use this to get cairo titlebars rather than GTK
+ if (GTK_FOUND)
+ include_directories (${GTK_INCLUDE_DIRS})
+ endif (GTK_FOUND)
+endif (OPTION_USE_WAYLAND AND NOT OPTION_USE_SYSTEM_LIBDECOR)
if (OPTION_USE_XFT)
set (USE_XFT X11_Xft_FOUND)
diff --git a/CMake/variables.cmake b/CMake/variables.cmake
index 27672c7d5..8908bd513 100644
--- a/CMake/variables.cmake
+++ b/CMake/variables.cmake
@@ -43,6 +43,11 @@ if (WIN32)
list (APPEND FLTK_LDLIBS -lole32 -luuid -lcomctl32 -lws2_32)
elseif (APPLE AND NOT OPTION_APPLE_X11)
list (APPEND FLTK_LDLIBS "-framework Cocoa")
+elseif (OPTION_USE_WAYLAND)
+ list (APPEND FLTK_LDLIBS "-lwayland-cursor -lwayland-client -lxkbcommon -ldbus-1")
+ if (OPTION_USE_SYSTEM_LIBDECOR)
+ list (APPEND FLTK_LDLIBS "-ldecor-0")
+ endif (OPTION_USE_SYSTEM_LIBDECOR)
else ()
list (APPEND FLTK_LDLIBS -lm)
endif (WIN32)