Fix wayland build - make x11 build optional.

This commit is contained in:
jmsgrogan 2023-10-02 16:27:40 +01:00
parent 7da1d2d539
commit bb222fd84d
12 changed files with 102 additions and 32 deletions

View file

@ -1,12 +1,18 @@
set(WAYLAND_FOUND FALSE)
find_path(_WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h)
find_path(_WAYLAND_EXTENSIONS_INCLUDE_DIR NAMES xdg-shell-client-protocol.h HINTS ENV WAYLAND_EXTENSION_DIR)
find_library(_WAYLAND_CLIENT_LIBRARY NAMES wayland-client libwayland-client)
find_program(_WAYLAND_SCANNER wayland-scanner)
find_file(_WAYLAND_XDG_SHELL_PROTO xdg-shell.xml HINTS /usr/share/wayland-protocols/stable/xdg-shell)
if (_WAYLAND_CLIENT_INCLUDE_DIR AND _WAYLAND_EXTENSIONS_INCLUDE_DIR AND _WAYLAND_CLIENT_LIBRARY)
if (_WAYLAND_CLIENT_INCLUDE_DIR AND _WAYLAND_SCANNER AND _WAYLAND_CLIENT_LIBRARY)
set(WAYLAND_FOUND TRUE)
set(WAYLAND_INCLUDE_DIRS ${_WAYLAND_EXTENSIONS_INCLUDE_DIR})
set(WAYLAND_XDG_SOURCE ${_WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp)
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARY} wayland-egl)
endif()
set(WAYLAND_LIBRARIES ${_WAYLAND_CLIENT_LIBRARY} wayland-egl)
add_custom_command(OUTPUT xdg-shell-client-procotol.h
xdg-shell-protocol.c
COMMAND ${_WAYLAND_SCANNER} client-header < ${_WAYLAND_XDG_SHELL_PROTO} > xdg-shell-client-protocol.h
COMMAND ${_WAYLAND_SCANNER} private-code < ${_WAYLAND_XDG_SHELL_PROTO} > xdg-shell-protocol.c
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()