From c84ec9aeddb1ed794d30f83bed9d14db4c5247aa Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:27:47 +0100 Subject: [PATCH] Build protocols in cmake --- CMakeLists.txt | 27 +++++++++++++++++++++++---- protocols.sh | 9 --------- 2 files changed, 23 insertions(+), 13 deletions(-) delete mode 100755 protocols.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 8de531f..1a6f12d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,16 +47,35 @@ include_directories( if (ENABLE_WAYLAND) message(STATUS "Wayland support is enabled!") + pkg_check_modules(wayland-cursor wayland-protocols egl wayland-egl) + + find_program(WaylandScanner NAMES wayland-scanner) + message(STATUS "Found WaylandScanner at ${WaylandScanner}") + execute_process( + COMMAND pkg-config --variable=pkgdatadir wayland-protocols + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}") + message(STATUS "Building protocols...") execute_process( - COMMAND ./protocols.sh + COMMAND ${WaylandScanner} client-header ${CMAKE_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process( + COMMAND ${WaylandScanner} private-code ${CMAKE_SOURCE_DIR}/protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.c + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process( + COMMAND ${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + execute_process( + COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.c WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - - pkg_check_modules(wayland-cursor wayland-protocols egl wayland-egl) add_compile_definitions(ENABLE_WAYLAND) set(WAYLAND_SOURCES "src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.h" "src/WallpaperEngine/Render/Drivers/CWaylandOpenGLDriver.cpp" "src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.cpp" - "src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.cpp" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h") + "src/WallpaperEngine/Render/Drivers/Detectors/CWaylandFullScreenDetector.h" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.cpp" "src/WallpaperEngine/Render/Drivers/Output/CWaylandOutput.h" + "xdg-shell-protocol.c" "wlr-layer-shell-unstable-v1-protocol.c") else() set(WAYLAND_SOURCES "") endif() diff --git a/protocols.sh b/protocols.sh deleted file mode 100755 index 605edf8..0000000 --- a/protocols.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -$(pkg-config --variable=wayland_scanner wayland-scanner) client-header protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h -$(pkg-config --variable=wayland_scanner wayland-scanner) private-code protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.c -$(pkg-config --variable=wayland_scanner wayland-scanner) client-header $(pkg-config --variable=pkgdatadir wayland-protocols)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h -$(pkg-config --variable=wayland_scanner wayland-scanner) private-code $(pkg-config --variable=pkgdatadir wayland-protocols)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.c - -cc -c -I. -std=c99 -lwayland-client -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement wlr-layer-shell-unstable-v1-protocol.c -o wlr-layer-shell-unstable-v1-protocol.o -cc -c -I. -std=c99 -lwayland-client -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement xdg-shell-protocol.c -o xdg-shell-protocol.o \ No newline at end of file