CMake: fix protocolnew external protos

This commit is contained in:
Mihai Fufezan 2024-09-20 14:29:25 +00:00
parent d369682614
commit 9e5c13d775
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg

View file

@ -78,7 +78,7 @@ pkg_check_modules(HYPRLAND_PROTOS IMPORTED_TARGET hyprland-protocols)
if(HYPRLAND_PROTOS_FOUND) if(HYPRLAND_PROTOS_FOUND)
set(HYPRLAND_PROTOCOLS "${HYPRLAND_PROTOS_PREFIX}/share/hyprland-protocols") set(HYPRLAND_PROTOCOLS "${HYPRLAND_PROTOS_PREFIX}/share/hyprland-protocols")
else() else()
set(HYPRLAND_PROTOCOLS "subprojects/hyprland-protocols") set(HYPRLAND_PROTOCOLS "${CMAKE_SOURCE_DIR}/subprojects/hyprland-protocols")
endif() endif()
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp") file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
@ -95,7 +95,7 @@ message(STATUS "Found wayland-client at ${WAYLAND_CLIENT_DIR}")
function(protocolnew protoPath protoName external) function(protocolnew protoPath protoName external)
if(external) if(external)
set(path ${CMAKE_SOURCE_DIR}/${protoPath}) set(path ${protoPath})
else() else()
set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath}) set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath})
endif() endif()
@ -115,15 +115,19 @@ function(protocolWayland)
COMMAND hyprwayland-scanner --wayland-enums --client COMMAND hyprwayland-scanner --wayland-enums --client
${WAYLAND_CLIENT_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/ ${WAYLAND_CLIENT_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
target_sources(xdg-desktop-portal-hyprland PRIVATE protocols/wayland.cpp protocols/wayland.hpp) target_sources(xdg-desktop-portal-hyprland PRIVATE protocols/wayland.cpp
protocols/wayland.hpp)
endfunction() endfunction()
protocolwayland() protocolwayland()
protocolnew("protocols" "wlr-foreign-toplevel-management-unstable-v1" true) protocolnew("${CMAKE_SOURCE_DIR}/protocols"
protocolnew("protocols" "wlr-screencopy-unstable-v1" true) "wlr-foreign-toplevel-management-unstable-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-global-shortcuts-v1" true) protocolnew("${CMAKE_SOURCE_DIR}/protocols" "wlr-screencopy-unstable-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-export-v1" true) protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-global-shortcuts-v1"
true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-export-v1"
true)
protocolnew("unstable/linux-dmabuf" "linux-dmabuf-unstable-v1" false) protocolnew("unstable/linux-dmabuf" "linux-dmabuf-unstable-v1" false)
# Installation # Installation