core: Move tearing to hyprwayland-scanner (#5657)

Adds a new dependency: hyprwayland-scanner https://github.com/hyprwm/hyprwayland-scanner

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
This commit is contained in:
Vaxry 2024-04-20 13:25:29 +01:00 committed by GitHub
parent 5c97b96278
commit ea95449402
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 108 additions and 78 deletions

View file

@ -71,6 +71,7 @@ pkg_get_variable(WaylandScanner wayland-scanner wayland_scanner)
message(STATUS "Found WaylandScanner at ${WaylandScanner}")
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
find_program(HYPRWAYLAND_SCANNER NAMES hyprwayland-scanner REQUIRED)
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring Hyprland in Debug with CMake")
@ -238,6 +239,19 @@ function(protocol protoPath protoName external)
target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c)
endif()
endfunction()
function(protocolNew protoPath protoName external)
if (external)
execute_process(
COMMAND hyprwayland-scanner ${protoPath} ${CMAKE_SOURCE_DIR}/protocols/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp)
else()
execute_process(
COMMAND hyprwayland-scanner ${WAYLAND_PROTOCOLS_DIR}/${protoPath} ${CMAKE_SOURCE_DIR}/protocols/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp)
endif()
endfunction()
target_link_libraries(Hyprland
${CMAKE_SOURCE_DIR}/subprojects/wlroots-hyprland/build/libwlroots.a
@ -260,10 +274,9 @@ protocol("stable/xdg-shell/xdg-shell.xml" "xdg-shell" false)
protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unstable-v1" false)
protocol("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
protocol("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
protocol("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v1" false)
protocol("staging/cursor-shape/cursor-shape-v1.xml" "cursor-shape-v1" false)
protocol("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
# tools
add_subdirectory(hyprctl)