From ba9e099914a931a80064f85ff8a91c8e3a79e2cf Mon Sep 17 00:00:00 2001 From: deepin-wm Date: Thu, 24 Sep 2026 16:36:33 +0800 Subject: [PATCH] refactor: drop unneeded WLR_VERSION macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Remove WLR_VERSION/WLR_VERSION_MAJOR/MINOR/PATCH from waylib's wconfig.h.in; WLR_HAVE_* feature macros are kept in use. 2. Drop the pkg_get_variable(WLR_VERSION_*) lines in waylib/src/server/CMakeLists.txt; WLROOTS_VERSION stays for the wlroots CMake export sanity check. 3. Remove the always-true WLR_VERSION_MINOR > 16 condition from ENABLE_VULKAN_RENDER (wlroots is pinned to 0.20). Log: No user-facing changes Influence: 1. Configure and build treeland: generated wconfig.h contains no WLR_VERSION macros 2. Build waylib standalone against waylib-wlroots.pc: feature macros stay intact 3. Verify Vulkan rendering path (ENABLE_VULKAN_RENDER) still compiles with wlroots 0.20 refactor: 移除不再需要的 WLR_VERSION 宏 1. waylib 的 wconfig.h.in 删除 WLR_VERSION/WLR_VERSION_MAJOR/MINOR/PATCH 宏,保留仍在使用的 WLR_HAVE_* feature 宏 2. 删除 waylib/src/server/CMakeLists.txt 中 pkg_get_variable(WLR_VERSION_*) 三行;WLROOTS_VERSION 保留用于 wlroots CMake export 存在性检查 3. ENABLE_VULKAN_RENDER 条件去掉恒真的 WLR_VERSION_MINOR > 16 (wlroots 锁定 0.20) Log: 无用户可见变化 Influence: 1. 配置并编译 treeland:生成的 wconfig.h 不再包含任何 WLR_VERSION 宏 2. waylib standalone 方式基于 waylib-wlroots.pc 构建:feature 宏保持完整 3. 验证 Vulkan 渲染路径(ENABLE_VULKAN_RENDER)在 wlroots 0.20 下正常编译 --- waylib/src/server/CMakeLists.txt | 8 ++------ waylib/src/server/cmake/wconfig.h.in | 5 ----- waylib/src/server/kernel/wglobal.h | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/waylib/src/server/CMakeLists.txt b/waylib/src/server/CMakeLists.txt index e5d0b24d67..f2ad27c64a 100644 --- a/waylib/src/server/CMakeLists.txt +++ b/waylib/src/server/CMakeLists.txt @@ -29,7 +29,7 @@ if (NOT TARGET Wlroots::wlroots) # Standalone Waylib build against an installed waylib-wlroots (built by # the wlroots CMake scaffold, which also installs its headers and # waylib-wlroots.pc). Resolve the library, its public dependencies and - # the wconfig.h version/feature metadata from that pkg-config file, so + # the wconfig.h feature metadata from that pkg-config file, so # no monorepo layout is assumed. find_package(PkgConfig REQUIRED) pkg_check_modules(WLR_INSTALLED REQUIRED IMPORTED_TARGET waylib-wlroots) @@ -39,9 +39,6 @@ if (NOT TARGET Wlroots::wlroots) list(APPEND WAYLIB_WLROOTS_INCLUDE_DIRS "$") endforeach() pkg_get_variable(WLROOTS_VERSION waylib-wlroots wlroots_version) - pkg_get_variable(WLR_VERSION_MAJOR waylib-wlroots wlroots_version_major) - pkg_get_variable(WLR_VERSION_MINOR waylib-wlroots wlroots_version_minor) - pkg_get_variable(WLR_VERSION_PATCH waylib-wlroots wlroots_version_patch) pkg_get_variable(_waylib_wlroots_features waylib-wlroots wlroots_features) foreach(_feature IN LISTS _waylib_wlroots_features) set(WLR_HAVE_${_feature} 1) @@ -418,8 +415,7 @@ set_target_properties(${TARGET} POSITION_INDEPENDENT_CODE ON ) -# Forward wlroots feature/version vars -# exported by the wlroots CMake build. +# Sanity check: the wlroots CMake export must be present. if(NOT DEFINED WLROOTS_VERSION) message(FATAL_ERROR "WLROOTS_VERSION not set; wlroots CMake export missing") endif() diff --git a/waylib/src/server/cmake/wconfig.h.in b/waylib/src/server/cmake/wconfig.h.in index e18e302ac8..40f089eabc 100644 --- a/waylib/src/server/cmake/wconfig.h.in +++ b/waylib/src/server/cmake/wconfig.h.in @@ -14,8 +14,3 @@ #cmakedefine WLR_HAVE_SESSION @WLR_HAVE_SESSION@ #cmakedefine WLR_HAVE_COLOR_MANAGEMENT @WLR_HAVE_COLOR_MANAGEMENT@ #cmakedefine WLR_HAVE_UDMABUF_ALLOCATOR @WLR_HAVE_UDMABUF_ALLOCATOR@ - -#define WLR_VERSION "@WLROOTS_VERSION@" -#define WLR_VERSION_MAJOR @WLROOTS_VERSION_MAJOR@ -#define WLR_VERSION_MINOR @WLROOTS_VERSION_MINOR@ -#define WLR_VERSION_PATCH @WLROOTS_VERSION_PATCH@ diff --git a/waylib/src/server/kernel/wglobal.h b/waylib/src/server/kernel/wglobal.h index f2f5db10c2..5553052801 100644 --- a/waylib/src/server/kernel/wglobal.h +++ b/waylib/src/server/kernel/wglobal.h @@ -38,7 +38,7 @@ #define W_QC(Class) Q_Q(const Class) #define W_PRIVATE_SLOT(Func) Q_PRIVATE_SLOT(d_func(), Func) -#if defined(WLR_HAVE_VULKAN_RENDERER) && QT_CONFIG(vulkan) && WLR_VERSION_MINOR > 16 +#if defined(WLR_HAVE_VULKAN_RENDERER) && QT_CONFIG(vulkan) #define ENABLE_VULKAN_RENDER #endif