mirror of https://github.com/encounter/SDL.git
cmake: Now generates Wayland protocol source bits like the configure script.
Fixes Bugzilla #3430.
This commit is contained in:
parent
d9e3972acb
commit
8a0704d15f
|
@ -539,6 +539,27 @@ macro(CheckMir)
|
|||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(WaylandProtocolGen _SCANNER _XML _PROTL)
|
||||
set(_WAYLAND_PROT_C_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
|
||||
set(_WAYLAND_PROT_H_CODE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-client-protocol.h")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_WAYLAND_PROT_H_CODE}"
|
||||
DEPENDS "${_XML}"
|
||||
COMMAND "${_SCANNER}"
|
||||
ARGS client-header "${_XML}" "${_WAYLAND_PROT_H_CODE}"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${_WAYLAND_PROT_C_CODE}"
|
||||
DEPENDS "${_WAYLAND_PROT_H_CODE}"
|
||||
COMMAND "${_SCANNER}"
|
||||
ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}"
|
||||
)
|
||||
|
||||
set(SOURCE_FILES ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c")
|
||||
endmacro()
|
||||
|
||||
# Requires:
|
||||
# - EGL
|
||||
# - PkgCheckModules
|
||||
|
@ -547,7 +568,51 @@ endmacro()
|
|||
# - HAVE_DLOPEN opt
|
||||
macro(CheckWayland)
|
||||
if(VIDEO_WAYLAND)
|
||||
pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
|
||||
pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon)
|
||||
|
||||
# We have to generate some protocol interface code for some various Wayland features.
|
||||
if(WAYLAND_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-client
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR_RC
|
||||
OUTPUT_VARIABLE WAYLAND_CORE_PROTOCOL_DIR
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT WAYLAND_CORE_PROTOCOL_DIR_RC EQUAL 0)
|
||||
set(WAYLAND_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WAYLAND_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE WAYLAND_PROTOCOLS_DIR_RC
|
||||
OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT WAYLAND_PROTOCOLS_DIR_RC EQUAL 0)
|
||||
set(WAYLAND_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WAYLAND_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
RESULT_VARIABLE WAYLAND_SCANNER_RC
|
||||
OUTPUT_VARIABLE WAYLAND_SCANNER
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT WAYLAND_SCANNER_RC EQUAL 0)
|
||||
set(WAYLAND_FOUND FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WAYLAND_FOUND)
|
||||
link_directories(
|
||||
${WAYLAND_LIBRARY_DIRS}
|
||||
|
@ -561,6 +626,17 @@ macro(CheckWayland)
|
|||
file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
|
||||
|
||||
# We have to generate some protocol interface code for some unstable Wayland features.
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols")
|
||||
|
||||
WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_CORE_PROTOCOL_DIR}/wayland.xml" "wayland")
|
||||
|
||||
foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1)
|
||||
string(REGEX REPLACE "\\-unstable\\-.*$" "" PROTSUBDIR ${_PROTL})
|
||||
WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_PROTOCOLS_DIR}/unstable/${PROTSUBDIR}/${_PROTL}.xml" "${_PROTL}")
|
||||
endforeach()
|
||||
|
||||
if(VIDEO_WAYLAND_QT_TOUCH)
|
||||
set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue