CMake: fix some weird internal dependencies (Wayland/X11)
Improve recognition of Wayland and X11 specific build options and remove duplicates from required dependencies (FLTK_LDLIBS) used in fltk-config. This should also fix the GitLab CI build process. To do: the logic to find the dependencies of Wayland and X11 is currently suboptimal. This will be improved in a later commit.
This commit is contained in:
parent
a7bc26e12a
commit
179c5d3521
@ -279,7 +279,7 @@ if(UNIX)
|
||||
pkg_check_modules(XKBCOMMON xkbcommon)
|
||||
if(NOT(WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
|
||||
message(STATUS "Not all software modules 'wayland-client>=1.18 wayland-cursor wayland-protocols>=1.15 xkbcommon' are present")
|
||||
message(STATUS "Consequently, FLTK_BACKEND_WAYLAND is set to OFF.")
|
||||
message(STATUS "Consequently, FLTK_BACKEND_WAYLAND is turned off.")
|
||||
unset(FLTK_BACKEND_WAYLAND CACHE)
|
||||
set(FLTK_BACKEND_WAYLAND 0)
|
||||
endif(NOT(WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
|
||||
@ -287,21 +287,19 @@ if(UNIX)
|
||||
|
||||
if(FLTK_BACKEND_WAYLAND)
|
||||
set(FLTK_USE_WAYLAND 1)
|
||||
if(FLTK_BACKEND_X11)
|
||||
include(FindX11)
|
||||
endif()
|
||||
if(X11_FOUND)
|
||||
set(FLTK_USE_X11 1) # to build a hybrid Wayland/X11 library
|
||||
include(FindX11)
|
||||
if(FLTK_BACKEND_X11 AND X11_FOUND)
|
||||
set(FLTK_USE_X11 1) # build a hybrid Wayland/X11 library
|
||||
else()
|
||||
set(FLTK_USE_X11 0) # to build a Wayland-only library
|
||||
endif(X11_FOUND)
|
||||
set(FLTK_USE_X11 0) # build a Wayland-only library
|
||||
endif()
|
||||
unset(FLTK_GRAPHICS_CAIRO CACHE)
|
||||
set(FLTK_GRAPHICS_CAIRO TRUE CACHE BOOL "all drawing to X11 windows uses Cairo")
|
||||
option(FLTK_USE_SYSTEM_LIBDECOR "use libdecor from the system" ON)
|
||||
set(USE_SYSTEM_LIBDECOR 1)
|
||||
unset(FLTK_USE_XRENDER CACHE)
|
||||
unset(FLTK_USE_XINERAMA CACHE)
|
||||
unset(FLTK_USE_XFT CACHE)
|
||||
# unset(FLTK_USE_XFT CACHE)
|
||||
unset(FLTK_USE_XCURSOR CACHE)
|
||||
unset(FLTK_USE_XFIXES CACHE)
|
||||
if(X11_FOUND)
|
||||
@ -794,16 +792,12 @@ endif(X11_Xft_FOUND)
|
||||
|
||||
# test option compatibility: Cairo for Xlib requires Pango
|
||||
if(FLTK_GRAPHICS_CAIRO)
|
||||
unset(FLTK_USE_PANGO CACHE)
|
||||
set(FLTK_USE_PANGO TRUE CACHE BOOL "use lib Pango")
|
||||
unset(FLTK_USE_PANGO CACHE)
|
||||
set(FLTK_USE_PANGO TRUE CACHE BOOL "use lib Pango")
|
||||
endif(FLTK_GRAPHICS_CAIRO)
|
||||
|
||||
if(FLTK_USE_PANGO OR FLTK_GRAPHICS_CAIRO)
|
||||
if(FLTK_BACKEND_WAYLAND OR FLTK_BACKEND_X11)
|
||||
set(USE_PANGOXFT false)
|
||||
else()
|
||||
set(USE_PANGOXFT true)
|
||||
endif()
|
||||
if(FLTK_USE_PANGO OR FLTK_GRAPHICS_CAIRO) # implies to use PANGOXFT
|
||||
set(USE_PANGOXFT true)
|
||||
endif()
|
||||
|
||||
# test option compatibility: Pango requires Xft
|
||||
@ -861,7 +855,7 @@ if((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
|
||||
list(APPEND FLTK_LDLIBS ${PANGOXFT_LDFLAGS})
|
||||
endif(USE_PANGOXFT)
|
||||
list(APPEND FLTK_LDLIBS ${PANGOCAIRO_LDFLAGS})
|
||||
list(APPEND FLTK_LDLIBS ${CAIRO_LDFLAGS})
|
||||
list(REMOVE_DUPLICATES FLTK_LDLIBS)
|
||||
|
||||
# *FIXME* Libraries should not be added explicitly if possible
|
||||
if(FLTK_BACKEND_WAYLAND)
|
||||
@ -871,6 +865,8 @@ if((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES FLTK_LDLIBS)
|
||||
|
||||
if(APPLE)
|
||||
get_filename_component(PANGO_L_PATH ${HAVE_LIB_PANGO} PATH)
|
||||
set(LDFLAGS "${LDFLAGS} -L${PANGO_L_PATH}")
|
||||
@ -932,7 +928,7 @@ if(FLTK_BACKEND_WAYLAND)
|
||||
if(FLTK_USE_LIBDECOR_GTK)
|
||||
pkg_check_modules(GTK gtk+-3.0)
|
||||
if(GTK_FOUND)
|
||||
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
|
||||
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
|
||||
else()
|
||||
message(WARNING "Installation of the development files for the GTK library "
|
||||
"(e.g., libgtk-3-dev) is recommended when using the gnome desktop.")
|
||||
|
Loading…
Reference in New Issue
Block a user