improvements to libdecor support in cmake

this makes it consistent with wayland support, and makes cmake side
in line with autotools' libdecor support.
This commit is contained in:
Ozkan Sezer 2021-08-03 14:01:02 +03:00
parent a15ec36547
commit 5b18ae29b7
3 changed files with 16 additions and 10 deletions

View File

@ -389,6 +389,7 @@ set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS})
set_option(VIDEO_WAYLAND "Use Wayland 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_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(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) 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}) set_option(VIDEO_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF) dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF)
@ -2593,9 +2594,6 @@ if(SDL_SHARED)
if(IOS OR TVOS) if(IOS OR TVOS)
set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc") set_property(TARGET SDL2 APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif() endif()
if(WAYLAND_LIBDECOR)
target_include_directories(SDL2 PRIVATE "${LIBDECOR_INCLUDE_DIRS}")
endif()
endif() endif()
if(ANDROID) if(ANDROID)
@ -2647,10 +2645,6 @@ if(SDL_STATIC)
if(IOS OR TVOS) if(IOS OR TVOS)
set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc") set_property(TARGET SDL2-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif() endif()
if(WAYLAND_LIBDECOR)
target_include_directories(SDL2-static PRIVATE "${LIBDECOR_INCLUDE_DIRS}")
target_link_libraries(SDL2-static "${LIBDECOR_LIBRARIES}")
endif()
endif() endif()
##### Tests ##### ##### Tests #####

View File

@ -701,9 +701,20 @@ macro(CheckWayland)
pkg_check_modules(LIBDECOR libdecor-0) pkg_check_modules(LIBDECOR libdecor-0)
if(LIBDECOR_FOUND) if(LIBDECOR_FOUND)
set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_WAYLAND_LIBDECOR TRUE)
FindLibraryAndSONAME(decor-0) set(HAVE_LIBDECOR_H 1)
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") link_directories(${LIBDECOR_LIBRARY_DIRS})
add_definitions(-DHAVE_LIBDECOR_H) 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()
endif() endif()

View File

@ -224,6 +224,7 @@
#cmakedefine HAVE_IMMINTRIN_H 1 #cmakedefine HAVE_IMMINTRIN_H 1
#cmakedefine HAVE_LIBUDEV_H 1 #cmakedefine HAVE_LIBUDEV_H 1
#cmakedefine HAVE_LIBSAMPLERATE_H 1 #cmakedefine HAVE_LIBSAMPLERATE_H 1
#cmakedefine HAVE_LIBDECOR_H 1
#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ #cmakedefine HAVE_D3D_H @HAVE_D3D_H@
#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ #cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@