stuff-from-scratch/infra/cmake/FindWayland.cmake
2023-10-02 16:27:40 +01:00

18 lines
885 B
CMake

set(WAYLAND_FOUND FALSE)
find_path(_WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h)
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_SCANNER AND _WAYLAND_CLIENT_LIBRARY)
set(WAYLAND_FOUND TRUE)
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()