Skip to content

Commit

Permalink
build/wayland: do not link to a target in wl_proto
Browse files Browse the repository at this point in the history
  • Loading branch information
outfoxxed committed Jan 12, 2025
1 parent 2c411fc commit 918dd23
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 34 deletions.
29 changes: 14 additions & 15 deletions src/wayland/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,46 @@ qs_add_pchset(wayland-protocol
<qstring.h>
)

function (wl_proto target name path)
function (wl_proto target name dir)
set(PROTO_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}/wl-proto/${name})
make_directory(${PROTO_BUILD_PATH})

set(WS_CLIENT_HEADER "${PROTO_BUILD_PATH}/wayland-${name}-client-protocol.h")
set(WS_CLIENT_CODE "${PROTO_BUILD_PATH}/wayland-${name}.c")
set(QWS_CLIENT_HEADER "${PROTO_BUILD_PATH}/qwayland-${name}.h")
set(QWS_CLIENT_CODE "${PROTO_BUILD_PATH}/qwayland-${name}.cpp")
set(PATH "${dir}/${name}.xml")

add_custom_command(
OUTPUT "${WS_CLIENT_HEADER}"
COMMAND Wayland::Scanner client-header "${path}" "${WS_CLIENT_HEADER}"
DEPENDS Wayland::Scanner "${path}"
COMMAND Wayland::Scanner client-header "${PATH}" "${WS_CLIENT_HEADER}"
DEPENDS Wayland::Scanner "${PATH}"
)

add_custom_command(
OUTPUT "${WS_CLIENT_CODE}"
COMMAND Wayland::Scanner private-code "${path}" "${WS_CLIENT_CODE}"
DEPENDS Wayland::Scanner "${path}"
COMMAND Wayland::Scanner private-code "${PATH}" "${WS_CLIENT_CODE}"
DEPENDS Wayland::Scanner "${PATH}"
)

add_custom_command(
OUTPUT "${QWS_CLIENT_HEADER}"
COMMAND Qt6::qtwaylandscanner client-header "${path}" > "${QWS_CLIENT_HEADER}"
DEPENDS Qt6::qtwaylandscanner "${path}"
COMMAND Qt6::qtwaylandscanner client-header "${PATH}" > "${QWS_CLIENT_HEADER}"
DEPENDS Qt6::qtwaylandscanner "${PATH}"
)

add_custom_command(
OUTPUT "${QWS_CLIENT_CODE}"
COMMAND Qt6::qtwaylandscanner client-code "${path}" > "${QWS_CLIENT_CODE}"
DEPENDS Qt6::qtwaylandscanner "${path}"
COMMAND Qt6::qtwaylandscanner client-code "${PATH}" > "${QWS_CLIENT_CODE}"
DEPENDS Qt6::qtwaylandscanner "${PATH}"
)

add_library(wl-proto-${name}-wl STATIC ${WS_CLIENT_HEADER} ${WS_CLIENT_CODE})
add_library(wl-proto-${name} STATIC ${QWS_CLIENT_HEADER} ${QWS_CLIENT_CODE})
add_library(${target} STATIC ${QWS_CLIENT_HEADER} ${QWS_CLIENT_CODE})

target_include_directories(wl-proto-${name} INTERFACE ${PROTO_BUILD_PATH})
target_link_libraries(wl-proto-${name} wl-proto-${name}-wl Qt6::WaylandClient Qt6::WaylandClientPrivate)
qs_pch(wl-proto-${name} SET wayland-protocol)

target_link_libraries(${target} PRIVATE wl-proto-${name})
target_include_directories(${target} INTERFACE ${PROTO_BUILD_PATH})
target_link_libraries(${target} wl-proto-${name}-wl Qt6::WaylandClient Qt6::WaylandClientPrivate)
qs_pch(${target} SET wayland-protocol)
endfunction()

# -----
Expand Down
6 changes: 2 additions & 4 deletions src/wayland/hyprland/focus_grab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ qs_add_module_deps_light(quickshell-hyprland-focus-grab Quickshell)

install_qml_module(quickshell-hyprland-focus-grab)

wl_proto(quickshell-hyprland-focus-grab
hyprland-focus-grab-v1
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-focus-grab-v1.xml"
)
wl_proto(wlp-hyprland-focus-grab hyprland-focus-grab-v1 "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(quickshell-hyprland-focus-grab PRIVATE
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
wlp-hyprland-focus-grab
)

qs_module_pch(quickshell-hyprland-focus-grab SET large)
Expand Down
6 changes: 2 additions & 4 deletions src/wayland/hyprland/global_shortcuts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ qt_add_qml_module(quickshell-hyprland-global-shortcuts

install_qml_module(quickshell-hyprland-global-shortcuts)

wl_proto(quickshell-hyprland-global-shortcuts
hyprland-global-shortcuts-v1
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-global-shortcuts-v1.xml"
)
wl_proto(wlp-hyprland-shortcuts hyprland-global-shortcuts-v1 "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(quickshell-hyprland-global-shortcuts PRIVATE
Qt::Qml Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
Qt::Quick # pch
wlp-hyprland-shortcuts
)

qs_module_pch(quickshell-hyprland-global-shortcuts)
Expand Down
6 changes: 2 additions & 4 deletions src/wayland/hyprland/surface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ qt_add_qml_module(quickshell-hyprland-surface-extensions

install_qml_module(quickshell-hyprland-surface-extensions)

wl_proto(quickshell-hyprland-surface-extensions
hyprland-surface-v1
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-surface-v1.xml"
)
wl_proto(wlp-hyprland-surface hyprland-surface-v1 "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(quickshell-hyprland-surface-extensions PRIVATE
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
wlp-hyprland-surface
)

qs_module_pch(quickshell-hyprland-surface-extensions)
Expand Down
3 changes: 2 additions & 1 deletion src/wayland/session_lock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ qt_add_library(quickshell-wayland-sessionlock STATIC
session_lock.cpp
)

wl_proto(quickshell-wayland-sessionlock ext-session-lock-v1 "${WAYLAND_PROTOCOLS}/staging/ext-session-lock/ext-session-lock-v1.xml")
wl_proto(wlp-session-lock ext-session-lock-v1 "${WAYLAND_PROTOCOLS}/staging/ext-session-lock")

target_link_libraries(quickshell-wayland-sessionlock PRIVATE
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
wlp-session-lock
)

qs_pch(quickshell-wayland-sessionlock SET large)
Expand Down
6 changes: 2 additions & 4 deletions src/wayland/toplevel_management/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ qs_add_module_deps_light(quickshell-wayland-toplevel-management

install_qml_module(quickshell-wayland-toplevel-management)

wl_proto(quickshell-wayland-toplevel-management
wlr-foreign-toplevel-management-unstable-v1
"${CMAKE_CURRENT_SOURCE_DIR}/wlr-foreign-toplevel-management-unstable-v1.xml"
)
wl_proto(wlp-foreign-toplevel wlr-foreign-toplevel-management-unstable-v1 "${CMAKE_CURRENT_SOURCE_DIR}")

target_link_libraries(quickshell-wayland-toplevel-management PRIVATE
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
wlp-foreign-toplevel
)

qs_module_pch(quickshell-wayland-toplevel-management SET large)
Expand Down
5 changes: 3 additions & 2 deletions src/wayland/wlr_layershell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ qs_add_module_deps_light(quickshell-wayland-layershell Quickshell Quickshell.Way

install_qml_module(quickshell-wayland-layershell)

wl_proto(quickshell-wayland-layershell wlr-layer-shell-unstable-v1 "${CMAKE_CURRENT_SOURCE_DIR}/wlr-layer-shell-unstable-v1.xml")
wl_proto(wlp-layer-shell wlr-layer-shell-unstable-v1 "${CMAKE_CURRENT_SOURCE_DIR}")

# link dependency of wlr-layer-shell's codegen
wl_proto(quickshell-wayland-layershell xdg-shell "${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml")
wl_proto(wlp-xdg-shell xdg-shell "${WAYLAND_PROTOCOLS}/stable/xdg-shell")

target_link_libraries(quickshell-wayland-layershell PRIVATE
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
wlp-layer-shell wlp-xdg-shell
)

qs_module_pch(quickshell-wayland-layershell SET large)
Expand Down

0 comments on commit 918dd23

Please sign in to comment.