[client] cmake: support building with libdecor

This commit is contained in:
Quantum 2021-03-06 05:47:40 -05:00 committed by Geoffrey McRae
parent 4031a862df
commit 82e107af8a
2 changed files with 18 additions and 1 deletions

View file

@ -41,6 +41,9 @@ add_feature_info(ENABLE_X11 ENABLE_X11 "X11 support.")
option(ENABLE_WAYLAND "Build with Wayland support" ON)
add_feature_info(ENABLE_WAYLAND ENABLE_WAYLAND "Wayland support.")
option(ENABLE_LIBDECOR "Build with libdecor support" OFF)
add_feature_info(ENABLE_LIBDECOR ENABLE_LIBDECOR "libdecor support.")
if (NOT ENABLE_SDL AND NOT ENABLE_X11 AND NOT ENABLE_WAYLAND)
message(FATAL_ERROR "One of ENABLE_SDL, ENABLE_X11, or ENABLE_WAYLAND must be on")
endif()

View file

@ -9,6 +9,20 @@ pkg_check_modules(DISPLAYSERVER_Wayland_PKGCONFIG REQUIRED
#pkg_check_modules(DISPLAYSERVER_Wayland_OPT_PKGCONFIG
#)
set(displayserver_Wayland_SHELL_SRC "")
if (ENABLE_LIBDECOR)
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED
libdecor-0.1
)
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_LIBRARIES ${DISPLAYSERVER_Wayland_LIBDECOR_LIBRARIES})
list(APPEND DISPLAYSERVER_Wayland_PKGCONFIG_INCLUDE_DIRS ${DISPLAYSERVER_Wayland_LIBDECOR_INCLUDE_DIRS})
list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c)
add_definitions(-D ENABLE_LIBDECOR)
else()
list(APPEND displayserver_Wayland_SHELL_SRC shell_xdg.c)
endif()
add_library(displayserver_Wayland STATIC
clipboard.c
cursor.c
@ -19,9 +33,9 @@ add_library(displayserver_Wayland STATIC
poll.c
state.c
registry.c
shell_xdg.c
wayland.c
window.c
${displayserver_Wayland_SHELL_SRC}
)
target_link_libraries(displayserver_Wayland