diff options
author | zjeffer <[email protected]> | 2024-05-21 23:25:45 +0200 |
---|---|---|
committer | Mihai Fufezan <[email protected]> | 2024-05-25 23:03:27 +0300 |
commit | 71c2ff3105942fb5d698225012d2082219e868de (patch) | |
tree | f60084fd689de379fcfd1108ca8df6f87c6b3faa /CMakeLists.txt | |
parent | 90f262aada21af9be1c5ccf89b8dc5e0d28478f1 (diff) | |
download | Hyprland-71c2ff3105942fb5d698225012d2082219e868de.tar.gz Hyprland-71c2ff3105942fb5d698225012d2082219e868de.zip |
Reapply "CMake: use add_custom_command for generating protocols (#6104)"
This reverts commit e419ef1873de01b0762f7f1a411994170a4d8cab.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 118 |
1 files changed, 63 insertions, 55 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 40e0f32a..858502cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,9 +113,11 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo pango pangocairo pixman-1 libdrm libinput hwdata libseat libdisplay-info libliftoff libudev gbm - hyprwayland-scanner>=0.3.8 hyprlang>=0.3.2 hyprcursor>=0.1.7 + hyprlang>=0.3.2 hyprcursor>=0.1.7 ) +find_package(hyprwayland-scanner 0.3.8 REQUIRED) + file(GLOB_RECURSE SRCFILES "src/*.cpp") set(TRACY_CPP_FILES "") @@ -219,42 +221,48 @@ target_link_libraries(Hyprland rt PkgConfig::deps) function(protocol protoPath protoName external) if (external) - execute_process( - COMMAND ${WaylandScanner} server-header ${protoPath} protocols/${protoName}-protocol.h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - execute_process( - COMMAND ${WaylandScanner} private-code ${protoPath} protocols/${protoName}-protocol.c - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c) + set(path ${CMAKE_SOURCE_DIR}/${protoPath}) else() - execute_process( - COMMAND ${WaylandScanner} server-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.h - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - execute_process( - COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.c - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c) + set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath}) endif() + + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h + COMMAND ${WaylandScanner} server-header ${path} protocols/${protoName}-protocol.h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.c + COMMAND ${WaylandScanner} private-code ${path} protocols/${protoName}-protocol.c + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + target_sources(Hyprland PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h) + target_sources(Hyprland PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.c) 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) + set(path ${CMAKE_SOURCE_DIR}/${protoPath}) 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) + set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath}) endif() + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp + ${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp + COMMAND hyprwayland-scanner ${path}/${protoName}.xml ${CMAKE_SOURCE_DIR}/protocols/ + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + target_sources(Hyprland PRIVATE protocols/${protoName}.cpp) + target_sources(Hyprland PRIVATE protocols/${protoName}.hpp) endfunction() function(protocolWayland) - execute_process( + add_custom_command( + OUTPUT ${CMAKE_SOURCE_DIR}/protocols/wayland.cpp + ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp COMMAND hyprwayland-scanner --wayland-enums ${WAYLAND_SERVER_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) target_sources(Hyprland PRIVATE protocols/wayland.cpp) + target_sources(Hyprland PRIVATE protocols/wayland.hpp) endfunction() target_link_libraries(Hyprland @@ -272,37 +280,37 @@ protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.x protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unstable-v1" false) protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v1" false) -protocolNew("protocols/wlr-gamma-control-unstable-v1.xml" "wlr-gamma-control-unstable-v1" true) -protocolNew("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true) -protocolNew("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true) -protocolNew("protocols/virtual-keyboard-unstable-v1.xml" "virtual-keyboard-unstable-v1" true) -protocolNew("protocols/wlr-virtual-pointer-unstable-v1.xml" "wlr-virtual-pointer-unstable-v1" true) -protocolNew("protocols/input-method-unstable-v2.xml" "input-method-unstable-v2" true) -protocolNew("protocols/wlr-output-management-unstable-v1.xml" "wlr-output-management-unstable-v1" true) -protocolNew("protocols/kde-server-decoration.xml" "kde-server-decoration" true) -protocolNew("protocols/wlr-data-control-unstable-v1.xml" "wlr-data-control-unstable-v1" true) -protocolNew("subprojects/hyprland-protocols/protocols/hyprland-focus-grab-v1.xml" "hyprland-focus-grab-v1" true) -protocolNew("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true) -protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false) -protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false) -protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false) -protocolNew("staging/cursor-shape/cursor-shape-v1.xml" "cursor-shape-v1" false) -protocolNew("unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" "idle-inhibit-unstable-v1" false) -protocolNew("unstable/relative-pointer/relative-pointer-unstable-v1.xml" "relative-pointer-unstable-v1" false) -protocolNew("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" "xdg-decoration-unstable-v1" false) -protocolNew("staging/alpha-modifier/alpha-modifier-v1.xml" "alpha-modifier-v1" false) -protocolNew("staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml" "ext-foreign-toplevel-list-v1" false) -protocolNew("unstable/pointer-gestures/pointer-gestures-unstable-v1.xml" "pointer-gestures-unstable-v1" false) -protocolNew("unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml" "keyboard-shortcuts-inhibit-unstable-v1" false) -protocolNew("unstable/text-input/text-input-unstable-v3.xml" "text-input-unstable-v3" false) -protocolNew("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" "pointer-constraints-unstable-v1" false) -protocolNew("staging/xdg-activation/xdg-activation-v1.xml" "xdg-activation-v1" false) -protocolNew("staging/ext-idle-notify/ext-idle-notify-v1.xml" "ext-idle-notify-v1" false) -protocolNew("staging/ext-session-lock/ext-session-lock-v1.xml" "ext-session-lock-v1" false) -protocolNew("stable/tablet/tablet-v2.xml" "tablet-v2" false) -protocolNew("stable/presentation-time/presentation-time.xml" "presentation-time" false) -protocolNew("stable/xdg-shell/xdg-shell.xml" "xdg-shell" false) -protocolNew("unstable/primary-selection/primary-selection-unstable-v1.xml" "primary-selection-unstable-v1" false) +protocolNew("protocols" "wlr-gamma-control-unstable-v1" true) +protocolNew("protocols" "wlr-foreign-toplevel-management-unstable-v1" true) +protocolNew("protocols" "wlr-output-power-management-unstable-v1" true) +protocolNew("protocols" "virtual-keyboard-unstable-v1" true) +protocolNew("protocols" "wlr-virtual-pointer-unstable-v1" true) +protocolNew("protocols" "input-method-unstable-v2" true) +protocolNew("protocols" "wlr-output-management-unstable-v1" true) +protocolNew("protocols" "kde-server-decoration" true) +protocolNew("protocols" "wlr-data-control-unstable-v1" true) +protocolNew("subprojects/hyprland-protocols/protocols" "hyprland-focus-grab-v1" true) +protocolNew("protocols" "wlr-layer-shell-unstable-v1" true) +protocolNew("staging/tearing-control" "tearing-control-v1" false) +protocolNew("staging/fractional-scale" "fractional-scale-v1" false) +protocolNew("unstable/xdg-output" "xdg-output-unstable-v1" false) +protocolNew("staging/cursor-shape" "cursor-shape-v1" false) +protocolNew("unstable/idle-inhibit" "idle-inhibit-unstable-v1" false) +protocolNew("unstable/relative-pointer" "relative-pointer-unstable-v1" false) +protocolNew("unstable/xdg-decoration" "xdg-decoration-unstable-v1" false) +protocolNew("staging/alpha-modifier" "alpha-modifier-v1" false) +protocolNew("staging/ext-foreign-toplevel-list" "ext-foreign-toplevel-list-v1" false) +protocolNew("unstable/pointer-gestures" "pointer-gestures-unstable-v1" false) +protocolNew("unstable/keyboard-shortcuts-inhibit" "keyboard-shortcuts-inhibit-unstable-v1" false) +protocolNew("unstable/text-input" "text-input-unstable-v3" false) +protocolNew("unstable/pointer-constraints" "pointer-constraints-unstable-v1" false) +protocolNew("staging/xdg-activation" "xdg-activation-v1" false) +protocolNew("staging/ext-idle-notify" "ext-idle-notify-v1" false) +protocolNew("staging/ext-session-lock" "ext-session-lock-v1" false) +protocolNew("stable/tablet" "tablet-v2" false) +protocolNew("stable/presentation-time" "presentation-time" false) +protocolNew("stable/xdg-shell" "xdg-shell" false) +protocolNew("unstable/primary-selection" "primary-selection-unstable-v1" false) protocolWayland() |