improvements to libdecor support in cmake this makes it consistent with wayland support, and makes cmake side in line with autotools' libdecor support.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 82f8730..a1bda7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -389,6 +389,7 @@ set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS})
set_option(VIDEO_WAYLAND "Use Wayland video driver" ${UNIX_SYS})
dep_option(WAYLAND_SHARED "Dynamically load Wayland support" ON "VIDEO_WAYLAND" OFF)
dep_option(WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "VIDEO_WAYLAND" ON)
+dep_option(LIBDECOR_SHARED "Dynamically load libdecor support" ON "WAYLAND_LIBDECOR" OFF)
dep_option(VIDEO_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "VIDEO_WAYLAND" OFF)
set_option(VIDEO_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF)
@@ -2593,9 +2594,6 @@ if(SDL_SHARED)
if(IOS OR TVOS)
set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif()
- if(WAYLAND_LIBDECOR)
- target_include_directories(SDL2 PRIVATE "${LIBDECOR_INCLUDE_DIRS}")
- endif()
endif()
if(ANDROID)
@@ -2647,10 +2645,6 @@ if(SDL_STATIC)
if(IOS OR TVOS)
set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif()
- if(WAYLAND_LIBDECOR)
- target_include_directories(SDL2-static PRIVATE "${LIBDECOR_INCLUDE_DIRS}")
- target_link_libraries(SDL2-static "${LIBDECOR_LIBRARIES}")
- endif()
endif()
##### Tests #####
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 4d90f9a..52fed5d 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -701,9 +701,20 @@ macro(CheckWayland)
pkg_check_modules(LIBDECOR libdecor-0)
if(LIBDECOR_FOUND)
set(HAVE_WAYLAND_LIBDECOR TRUE)
- FindLibraryAndSONAME(decor-0)
- set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
- add_definitions(-DHAVE_LIBDECOR_H)
+ set(HAVE_LIBDECOR_H 1)
+ link_directories(${LIBDECOR_LIBRARY_DIRS})
+ include_directories(${LIBDECOR_INCLUDE_DIRS})
+ if(LIBDECOR_SHARED)
+ if(NOT HAVE_DLOPEN)
+ message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
+ else()
+ set(HAVE_LIBDECOR_SHARED TRUE)
+ FindLibraryAndSONAME(decor-0)
+ set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
+ endif()
+ else()
+ set(EXTRA_LIBS ${LIBDECOR_LIBRARIES} ${EXTRA_LIBS})
+ endif()
endif()
endif()
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 897d06a..511ffc0 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -224,6 +224,7 @@
#cmakedefine HAVE_IMMINTRIN_H 1
#cmakedefine HAVE_LIBUDEV_H 1
#cmakedefine HAVE_LIBSAMPLERATE_H 1
+#cmakedefine HAVE_LIBDECOR_H 1
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@
#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@