stuff-from-scratch/infra/cmake/FindWayland.cmake

19 lines
885 B
CMake
Raw Normal View History

2022-11-30 12:30:20 +00:00
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)
2022-11-30 12:30:20 +00:00
if (_WAYLAND_CLIENT_INCLUDE_DIR AND _WAYLAND_SCANNER AND _WAYLAND_CLIENT_LIBRARY)
2022-11-30 12:30:20 +00:00
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()