Files
z-bar-qt/Plugins/cmake/wayland-protocol.cmake
zach 11e94fbb4b
C++ / fmt (pull_request) Failing after 4s
C++ / build (pull_request) Failing after 9s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Successful in 28s
Rust / build (pull_request) Successful in 47s
Python / verify (pull_request) Successful in 1m40s
Rust / fmt (pull_request) Successful in 29s
Rust / clippy (pull_request) Successful in 46s
Merge branch 'main' into feat/llm-chat-tab
2026-10-05 19:33:42 +02:00

59 lines
1.9 KiB
CMake

find_program(QTWAYLANDSCANNER_EXECUTABLE qtwaylandscanner REQUIRED)
find_program(WAYLAND_SCANNER_EXECUTABLE wayland-scanner REQUIRED)
pkg_get_variable(WAYLAND_PROTOCOLS wayland-protocols pkgdatadir)
if(NOT WAYLAND_PROTOCOLS)
message(FATAL_ERROR "wayland-protocols not found")
endif()
function(wl_proto arg_TARGET arg_PROTOCOL arg_XML_DIR)
set(out_dir "${CMAKE_BINARY_DIR}/wayland-protocols/${arg_TARGET}")
file(MAKE_DIRECTORY "${out_dir}")
set(xml "${arg_XML_DIR}/${arg_PROTOCOL}.xml")
add_custom_command(
OUTPUT "${out_dir}/wayland-${arg_PROTOCOL}-client-protocol.h"
"${out_dir}/wayland-${arg_PROTOCOL}.c"
COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header "${xml}"
"${out_dir}/wayland-${arg_PROTOCOL}-client-protocol.h"
COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code "${xml}"
"${out_dir}/wayland-${arg_PROTOCOL}.c"
DEPENDS "${xml}"
COMMENT "Generating ${arg_PROTOCOL} protocol files"
)
add_custom_command(
OUTPUT "${out_dir}/qwayland-${arg_PROTOCOL}.h"
"${out_dir}/qwayland-${arg_PROTOCOL}.cpp"
COMMAND ${QTWAYLANDSCANNER_EXECUTABLE} client-header "${xml}"
> "${out_dir}/qwayland-${arg_PROTOCOL}.h"
COMMAND ${QTWAYLANDSCANNER_EXECUTABLE} client-code "${xml}"
> "${out_dir}/qwayland-${arg_PROTOCOL}.cpp"
DEPENDS "${xml}" "${out_dir}/wayland-${arg_PROTOCOL}-client-protocol.h"
COMMENT "Generating ${arg_PROTOCOL} client wrapper"
)
add_library(
${arg_TARGET}
STATIC
"${out_dir}/wayland-${arg_PROTOCOL}.c"
"${out_dir}/qwayland-${arg_PROTOCOL}.cpp"
)
set_source_files_properties(
"${out_dir}/qwayland-${arg_PROTOCOL}.cpp"
PROPERTIES COMPILE_OPTIONS
"-Wno-old-style-cast;-Wno-sign-conversion;-Wno-conversion;-Wno-shadow"
)
set_target_properties(${arg_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(${arg_TARGET} PUBLIC "${out_dir}")
target_link_libraries(
${arg_TARGET}
PUBLIC
Qt::Core
Qt::WaylandClient
Qt::WaylandClientPrivate
PkgConfig::WAYLAND_CLIENT
)
endfunction()