From 78680138c216cbc85a3d5f82e6fce99596d17f71 Mon Sep 17 00:00:00 2001 From: ChestnutYueyue <952134128@qq.com> Date: Sun, 15 Feb 2026 15:35:26 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E6=A0=B9=E6=8D=AE=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AESDL2=E7=9A=84Wayland?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在Linux平台下检测XDG_SESSION_TYPE环境变量,动态启用SDL2的Wayland后端支持。修改xmake.lua构建配置以适配不同显示服务器环境。 --- xmake.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xmake.lua b/xmake.lua index 11db356..5d3a8ce 100644 --- a/xmake.lua +++ b/xmake.lua @@ -85,9 +85,21 @@ end if target_plat ~= "switch" then add_requires("glm") add_requires("nlohmann_json") - add_requires("libsdl2") + local sdl2_configs = { + configs = { + wayland = false + } + } + if target_plat == "linux" then + local is_wayland = os.getenv("XDG_SESSION_TYPE") == "wayland" + if is_wayland then + sdl2_configs.configs.wayland = true + end + end + add_requires("libsdl2", sdl2_configs) end + -- ============================================== -- 加载构建目标 -- ==============================================