build: 根据平台环境配置SDL2的Wayland支持
在Linux平台下检测XDG_SESSION_TYPE环境变量,动态启用SDL2的Wayland后端支持。修改xmake.lua构建配置以适配不同显示服务器环境。
This commit is contained in:
parent
0700bad5d9
commit
78680138c2
14
xmake.lua
14
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
|
||||
|
||||
|
||||
-- ==============================================
|
||||
-- 加载构建目标
|
||||
-- ==============================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue