Extra2D/xmake.lua

82 lines
2.0 KiB
Lua

-- ==============================================
-- Extra2D - 2D Game Engine
-- Build System: Xmake
-- Platforms: MinGW (Windows), Nintendo Switch
-- ==============================================
-- 项目元信息
set_project("Extra2D")
set_version("1.2.0")
set_license("MIT")
-- 语言和编码设置
set_languages("c++17")
set_encodings("utf-8")
-- 构建模式
add_rules("mode.debug", "mode.release")
-- ==============================================
-- 构建选项
-- ==============================================
option("debug_logs")
set_default(false)
set_showmenu(true)
set_description("Enable debug logging")
option_end()
-- ==============================================
-- 平台检测与配置
-- ==============================================
local host_plat = os.host()
local target_plat = get_config("plat") or host_plat
local supported_plats = {mingw = true, switch = true}
if not supported_plats[target_plat] then
if host_plat == "windows" then
target_plat = "mingw"
else
error("Unsupported platform: " .. target_plat .. ". Supported platforms: mingw, switch")
end
end
set_plat(target_plat)
if target_plat == "switch" then
set_arch("arm64")
elseif target_plat == "mingw" then
set_arch("x86_64")
end
-- ==============================================
-- 加载工具链配置
-- ==============================================
if target_plat == "switch" then
includes("xmake/toolchains/switch.lua")
set_toolchains("switch")
elseif target_plat == "mingw" then
set_toolchains("mingw")
end
-- ==============================================
-- 添加依赖包 (MinGW)
-- ==============================================
if target_plat == "mingw" then
add_requires("glm", "libsdl2")
end
-- ==============================================
-- 加载构建目标
-- ==============================================
-- 加载引擎库定义
includes("xmake/engine.lua")
-- 定义引擎库
define_extra2d_engine()