refactor(渲染器): 优化相机切换时的渲染批处理 feat(调试工具): 新增游戏调试UI场景和九宫格面板组件 fix(动画系统): 跳过缺失的动画资源加载并记录日志 perf(资源加载): 使用BinaryFileStreamReader优化NPK文件解析 feat(地图系统): 支持多边形可行走区域调试显示 style(代码格式): 清理多余空格和统一文件编码 docs(注释): 补充关键类和方法的文档说明 test(启动跟踪): 添加启动过程性能跟踪工具 chore(依赖): 添加SDL2_ttf库支持
91 lines
3.7 KiB
Lua
91 lines
3.7 KiB
Lua
-- MinGW 编译配置
|
|
set_toolchains("mingw")
|
|
|
|
add_requires("libsdl2", {configs = {shared = true}})
|
|
add_requires("libsdl2_image", {configs = {shared = true}})
|
|
add_requires("libsdl2_mixer", {configs = {shared = true}})
|
|
add_requires("libsdl2_ttf", {configs = {shared = true}})
|
|
add_requires("glm")
|
|
add_requires("zlib")
|
|
add_requires("squirrel")
|
|
|
|
target("Frostbite2D")
|
|
set_kind("binary")
|
|
add_files(path.join(os.projectdir(), "Frostbite2D/src/**.cpp"))
|
|
add_files(path.join(os.projectdir(), "Frostbite2D/src/**.c"))
|
|
add_includedirs(path.join(os.projectdir(), "Frostbite2D/include"))
|
|
|
|
add_files(path.join(os.projectdir(), "Game/src/**.cpp"))
|
|
add_includedirs(path.join(os.projectdir(), "Game/include"))
|
|
|
|
add_packages("libsdl2")
|
|
add_packages("libsdl2_image")
|
|
add_packages("libsdl2_mixer")
|
|
add_packages("libsdl2_ttf")
|
|
add_packages("glm")
|
|
add_packages("zlib")
|
|
add_packages("squirrel")
|
|
|
|
-- 复制 assets 目录到输出目录
|
|
after_build(function (target)
|
|
local assetHelper = import("build_helpers.assets")
|
|
|
|
-- 复制 assets 目录
|
|
local assets_dir = path.join(os.projectdir(), "Game/assets")
|
|
local output_dir = target:targetdir()
|
|
local target_assets_dir = path.join(output_dir, "assets")
|
|
|
|
assetHelper.syncAssets(assets_dir, target_assets_dir)
|
|
|
|
-- 复制所有依赖的 DLL (Windows 平台)
|
|
if is_plat("mingw") or is_plat("windows") then
|
|
-- 复制所有包的 DLL 文件
|
|
local all_pkgs = {"libsdl2", "libsdl2_image", "libsdl2_mixer", "libsdl2_ttf"}
|
|
for _, pkg_name in ipairs(all_pkgs) do
|
|
local pkg = target:pkg(pkg_name)
|
|
if pkg then
|
|
local libfiles = pkg:get("libfiles")
|
|
if libfiles then
|
|
for _, libfile in ipairs(libfiles) do
|
|
if libfile:endswith(".dll") then
|
|
local target_dll = path.join(output_dir, path.filename(libfile))
|
|
os.cp(libfile, target_dll)
|
|
print("Copy DLL: " .. path.filename(libfile))
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 从 xmake 包目录复制所有可能的依赖 DLL
|
|
local user_profile = os.getenv("USERPROFILE") or ""
|
|
local packages_dir = path.join(user_profile, ".xmake/packages/l")
|
|
|
|
local common_dll_patterns = {
|
|
path.join(packages_dir, "libogg/**/*.dll"),
|
|
path.join(packages_dir, "libvorbis/**/*.dll"),
|
|
path.join(packages_dir, "libvorbisfile/**/*.dll"),
|
|
path.join(packages_dir, "libmpg123/**/*.dll"),
|
|
path.join(packages_dir, "libflac/**/*.dll"),
|
|
path.join(packages_dir, "libsndfile/**/*.dll"),
|
|
path.join(packages_dir, "libmodplug/**/*.dll"),
|
|
path.join(packages_dir, "opus/**/*.dll"),
|
|
path.join(packages_dir, "opusfile/**/*.dll"),
|
|
path.join(packages_dir, "**/*.dll")
|
|
}
|
|
|
|
for _, dll_pattern in ipairs(common_dll_patterns) do
|
|
local dll_files = os.files(dll_pattern)
|
|
for _, dll_file in ipairs(dll_files) do
|
|
local dll_name = path.filename(dll_file)
|
|
local target_dll = path.join(output_dir, dll_name)
|
|
if not os.isfile(target_dll) then
|
|
os.cp(dll_file, target_dll)
|
|
print("Copy dependency DLL: " .. dll_name)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
target_end()
|