mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-03-19 17:42:22 +00:00
Simplify adding new wayland protocols (#2110)
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
This commit is contained in:
parent
4141f80286
commit
e20b0a9d3b
@ -273,7 +273,7 @@ if(BUILD_GUI)
|
|||||||
endif(BUILD_GUI)
|
endif(BUILD_GUI)
|
||||||
|
|
||||||
if(BUILD_WAYLAND)
|
if(BUILD_WAYLAND)
|
||||||
set(wl_srcs
|
set(wl_sources
|
||||||
wl.cc
|
wl.cc
|
||||||
wl.h
|
wl.h
|
||||||
display-wayland.cc
|
display-wayland.cc
|
||||||
@ -281,26 +281,62 @@ if(BUILD_WAYLAND)
|
|||||||
xdg-shell-protocol.c
|
xdg-shell-protocol.c
|
||||||
wlr-layer-shell-protocol.c
|
wlr-layer-shell-protocol.c
|
||||||
)
|
)
|
||||||
set(optional_sources ${optional_sources} ${wl_srcs})
|
|
||||||
|
|
||||||
# generate protocol implementations
|
# Looks up wayland protocol files, build respective headers/sources, and adds
|
||||||
set(XDG_PROT_DEF "${Wayland_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml")
|
# them to the build.
|
||||||
add_custom_command(
|
#
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-protocol.h
|
# Use: add_protocol(name [v<version>])
|
||||||
COMMAND ${Wayland_SCANNER} client-header ${XDG_PROT_DEF} xdg-shell-client-protocol.h)
|
macro(ADD_PROTOCOL name)
|
||||||
add_custom_command(
|
set(WL_PROTOCOL_PATHS
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-protocol.c
|
"${CMAKE_CURRENT_SOURCE_DIR}/wl_protocols" # first for reproducibility
|
||||||
COMMAND ${Wayland_SCANNER} private-code ${XDG_PROT_DEF} xdg-shell-protocol.c
|
"${Wayland_PROTOCOLS_DIR}/stable/${name}"
|
||||||
DEPENDS xdg-shell-client-protocol.h)
|
"${Wayland_PROTOCOLS_DIR}/stable"
|
||||||
|
"${Wayland_PROTOCOLS_DIR}/unstable/${name}"
|
||||||
|
"${Wayland_PROTOCOLS_DIR}/unstable"
|
||||||
|
)
|
||||||
|
if(${ARGC} GREATER 1)
|
||||||
|
set(VERSION ${ARGV1})
|
||||||
|
find_file(PROTOCOL_FILE
|
||||||
|
NAMES
|
||||||
|
"${name}-${VERSION}.xml"
|
||||||
|
"${name}-unstable-${VERSION}.xml"
|
||||||
|
PATHS ${WL_PROTOCOL_PATHS}
|
||||||
|
NO_CACHE
|
||||||
|
REQUIRED
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
message(STATUS "PROTOCOL '${name}' ${VERSION} file: ${PROTOCOL_FILE}")
|
||||||
|
unset(VERSION)
|
||||||
|
else()
|
||||||
|
find_file(PROTOCOL_FILE
|
||||||
|
NAMES
|
||||||
|
"${name}.xml"
|
||||||
|
"${name}-unstable.xml"
|
||||||
|
PATHS ${WL_PROTOCOL_PATHS}
|
||||||
|
NO_CACHE
|
||||||
|
REQUIRED
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
message(STATUS "PROTOCOL '${name}' file: ${PROTOCOL_FILE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}-client-protocol.h"
|
||||||
|
COMMAND ${Wayland_SCANNER} client-header "${PROTOCOL_FILE}" "${name}-client-protocol.h")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}-protocol.c
|
||||||
|
COMMAND ${Wayland_SCANNER} private-code "${PROTOCOL_FILE}" "${name}-protocol.c"
|
||||||
|
DEPENDS "${name}-client-protocol.h")
|
||||||
|
list(APPEND wl_sources "${name}-protocol.c")
|
||||||
|
unset(PROTOCOL_FILE)
|
||||||
|
unset(WL_PROTOCOL_PATHS)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
add_protocol(xdg-shell)
|
||||||
|
add_protocol(wlr-layer-shell v1)
|
||||||
|
|
||||||
set(WLR_LAYER_SHELL_PROT_DEF "${CMAKE_CURRENT_SOURCE_DIR}/wlr-layer-shell-unstable-v1.xml")
|
set(optional_sources ${optional_sources} ${wl_sources})
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/wlr-layer-shell-client-protocol.h
|
|
||||||
COMMAND ${Wayland_SCANNER} client-header ${WLR_LAYER_SHELL_PROT_DEF} wlr-layer-shell-client-protocol.h)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/wlr-layer-shell-protocol.c
|
|
||||||
COMMAND ${Wayland_SCANNER} private-code ${WLR_LAYER_SHELL_PROT_DEF} wlr-layer-shell-protocol.c
|
|
||||||
DEPENDS wlr-layer-shell-client-protocol.h)
|
|
||||||
endif(BUILD_WAYLAND)
|
endif(BUILD_WAYLAND)
|
||||||
|
|
||||||
if(BUILD_HDDTEMP)
|
if(BUILD_HDDTEMP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user