Skip to content

Commit 918dd23

Browse files
committed
build/wayland: do not link to a target in wl_proto
1 parent 2c411fc commit 918dd23

File tree

7 files changed

+27
-34
lines changed

7 files changed

+27
-34
lines changed

src/wayland/CMakeLists.txt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,46 @@ qs_add_pchset(wayland-protocol
2828
<qstring.h>
2929
)
3030

31-
function (wl_proto target name path)
31+
function (wl_proto target name dir)
3232
set(PROTO_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}/wl-proto/${name})
3333
make_directory(${PROTO_BUILD_PATH})
3434

3535
set(WS_CLIENT_HEADER "${PROTO_BUILD_PATH}/wayland-${name}-client-protocol.h")
3636
set(WS_CLIENT_CODE "${PROTO_BUILD_PATH}/wayland-${name}.c")
3737
set(QWS_CLIENT_HEADER "${PROTO_BUILD_PATH}/qwayland-${name}.h")
3838
set(QWS_CLIENT_CODE "${PROTO_BUILD_PATH}/qwayland-${name}.cpp")
39+
set(PATH "${dir}/${name}.xml")
3940

4041
add_custom_command(
4142
OUTPUT "${WS_CLIENT_HEADER}"
42-
COMMAND Wayland::Scanner client-header "${path}" "${WS_CLIENT_HEADER}"
43-
DEPENDS Wayland::Scanner "${path}"
43+
COMMAND Wayland::Scanner client-header "${PATH}" "${WS_CLIENT_HEADER}"
44+
DEPENDS Wayland::Scanner "${PATH}"
4445
)
4546

4647
add_custom_command(
4748
OUTPUT "${WS_CLIENT_CODE}"
48-
COMMAND Wayland::Scanner private-code "${path}" "${WS_CLIENT_CODE}"
49-
DEPENDS Wayland::Scanner "${path}"
49+
COMMAND Wayland::Scanner private-code "${PATH}" "${WS_CLIENT_CODE}"
50+
DEPENDS Wayland::Scanner "${PATH}"
5051
)
5152

5253
add_custom_command(
5354
OUTPUT "${QWS_CLIENT_HEADER}"
54-
COMMAND Qt6::qtwaylandscanner client-header "${path}" > "${QWS_CLIENT_HEADER}"
55-
DEPENDS Qt6::qtwaylandscanner "${path}"
55+
COMMAND Qt6::qtwaylandscanner client-header "${PATH}" > "${QWS_CLIENT_HEADER}"
56+
DEPENDS Qt6::qtwaylandscanner "${PATH}"
5657
)
5758

5859
add_custom_command(
5960
OUTPUT "${QWS_CLIENT_CODE}"
60-
COMMAND Qt6::qtwaylandscanner client-code "${path}" > "${QWS_CLIENT_CODE}"
61-
DEPENDS Qt6::qtwaylandscanner "${path}"
61+
COMMAND Qt6::qtwaylandscanner client-code "${PATH}" > "${QWS_CLIENT_CODE}"
62+
DEPENDS Qt6::qtwaylandscanner "${PATH}"
6263
)
6364

6465
add_library(wl-proto-${name}-wl STATIC ${WS_CLIENT_HEADER} ${WS_CLIENT_CODE})
65-
add_library(wl-proto-${name} STATIC ${QWS_CLIENT_HEADER} ${QWS_CLIENT_CODE})
66+
add_library(${target} STATIC ${QWS_CLIENT_HEADER} ${QWS_CLIENT_CODE})
6667

67-
target_include_directories(wl-proto-${name} INTERFACE ${PROTO_BUILD_PATH})
68-
target_link_libraries(wl-proto-${name} wl-proto-${name}-wl Qt6::WaylandClient Qt6::WaylandClientPrivate)
69-
qs_pch(wl-proto-${name} SET wayland-protocol)
70-
71-
target_link_libraries(${target} PRIVATE wl-proto-${name})
68+
target_include_directories(${target} INTERFACE ${PROTO_BUILD_PATH})
69+
target_link_libraries(${target} wl-proto-${name}-wl Qt6::WaylandClient Qt6::WaylandClientPrivate)
70+
qs_pch(${target} SET wayland-protocol)
7271
endfunction()
7372

7473
# -----

src/wayland/hyprland/focus_grab/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ qs_add_module_deps_light(quickshell-hyprland-focus-grab Quickshell)
1414

1515
install_qml_module(quickshell-hyprland-focus-grab)
1616

17-
wl_proto(quickshell-hyprland-focus-grab
18-
hyprland-focus-grab-v1
19-
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-focus-grab-v1.xml"
20-
)
17+
wl_proto(wlp-hyprland-focus-grab hyprland-focus-grab-v1 "${CMAKE_CURRENT_SOURCE_DIR}")
2118

2219
target_link_libraries(quickshell-hyprland-focus-grab PRIVATE
2320
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
21+
wlp-hyprland-focus-grab
2422
)
2523

2624
qs_module_pch(quickshell-hyprland-focus-grab SET large)

src/wayland/hyprland/global_shortcuts/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ qt_add_qml_module(quickshell-hyprland-global-shortcuts
1212

1313
install_qml_module(quickshell-hyprland-global-shortcuts)
1414

15-
wl_proto(quickshell-hyprland-global-shortcuts
16-
hyprland-global-shortcuts-v1
17-
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-global-shortcuts-v1.xml"
18-
)
15+
wl_proto(wlp-hyprland-shortcuts hyprland-global-shortcuts-v1 "${CMAKE_CURRENT_SOURCE_DIR}")
1916

2017
target_link_libraries(quickshell-hyprland-global-shortcuts PRIVATE
2118
Qt::Qml Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
2219
Qt::Quick # pch
20+
wlp-hyprland-shortcuts
2321
)
2422

2523
qs_module_pch(quickshell-hyprland-global-shortcuts)

src/wayland/hyprland/surface/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ qt_add_qml_module(quickshell-hyprland-surface-extensions
1212

1313
install_qml_module(quickshell-hyprland-surface-extensions)
1414

15-
wl_proto(quickshell-hyprland-surface-extensions
16-
hyprland-surface-v1
17-
"${CMAKE_CURRENT_SOURCE_DIR}/hyprland-surface-v1.xml"
18-
)
15+
wl_proto(wlp-hyprland-surface hyprland-surface-v1 "${CMAKE_CURRENT_SOURCE_DIR}")
1916

2017
target_link_libraries(quickshell-hyprland-surface-extensions PRIVATE
2118
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
19+
wlp-hyprland-surface
2220
)
2321

2422
qs_module_pch(quickshell-hyprland-surface-extensions)

src/wayland/session_lock/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ qt_add_library(quickshell-wayland-sessionlock STATIC
66
session_lock.cpp
77
)
88

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

1111
target_link_libraries(quickshell-wayland-sessionlock PRIVATE
1212
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
13+
wlp-session-lock
1314
)
1415

1516
qs_pch(quickshell-wayland-sessionlock SET large)

src/wayland/toplevel_management/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ qs_add_module_deps_light(quickshell-wayland-toplevel-management
1616

1717
install_qml_module(quickshell-wayland-toplevel-management)
1818

19-
wl_proto(quickshell-wayland-toplevel-management
20-
wlr-foreign-toplevel-management-unstable-v1
21-
"${CMAKE_CURRENT_SOURCE_DIR}/wlr-foreign-toplevel-management-unstable-v1.xml"
22-
)
19+
wl_proto(wlp-foreign-toplevel wlr-foreign-toplevel-management-unstable-v1 "${CMAKE_CURRENT_SOURCE_DIR}")
2320

2421
target_link_libraries(quickshell-wayland-toplevel-management PRIVATE
2522
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
23+
wlp-foreign-toplevel
2624
)
2725

2826
qs_module_pch(quickshell-wayland-toplevel-management SET large)

src/wayland/wlr_layershell/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ qs_add_module_deps_light(quickshell-wayland-layershell Quickshell Quickshell.Way
1414

1515
install_qml_module(quickshell-wayland-layershell)
1616

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

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

2222
target_link_libraries(quickshell-wayland-layershell PRIVATE
2323
Qt::Quick Qt::WaylandClient Qt::WaylandClientPrivate wayland-client
24+
wlp-layer-shell wlp-xdg-shell
2425
)
2526

2627
qs_module_pch(quickshell-wayland-layershell SET large)

0 commit comments

Comments
 (0)