Extra2D/tests/xmake.lua

60 lines
1.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Extra2D 测试套件构建脚本
-- 使用 GoogleTest 标准测试框架
-- 添加 gtest 包依赖
add_requires("gtest")
target("extra2d_tests")
set_kind("binary")
set_languages("c++17")
-- 添加 gtest 包
add_packages("gtest")
-- 添加测试源文件
add_files("*.cpp")
-- 添加头文件搜索路径
add_includedirs(".")
add_includedirs("../include")
-- 添加引擎源文件(仅核心模块,避免平台依赖)
add_files("../src/context/context.cpp")
add_files("../src/module/module_registry.cpp")
add_files("../src/module/timer_module.cpp")
add_files("../src/plugin/plugin_loader.cpp")
add_files("../src/event/event_bus.cpp")
add_files("../src/utils/random.cpp")
-- 注意logger.cpp 在 TEST_BUILD 模式下使用条件编译避免 SDL 依赖
-- 第三方库
add_includedirs("../third_party/nlohmann")
add_includedirs("../third_party/stb")
-- 定义 TEST_BUILD 宏,用于条件编译
add_defines("TEST_BUILD")
-- 编译选项
if is_mode("debug") then
add_defines("DEBUG")
set_symbols("debug")
set_optimize("none")
else
add_defines("NDEBUG")
set_optimize("fastest")
set_strip("all")
end
-- 警告设置
set_warnings("all")
-- 平台特定设置
if is_plat("windows") then
add_cxflags("/wd4267", "/wd4244", "/wd4996", "/wd4100", "/wd4458")
add_syslinks("kernel32", "user32")
elseif is_plat("mingw") then
add_cxflags("-Wno-unused-parameter", "-Wno-unused-variable")
else
add_cxflags("-Wno-unused-parameter", "-Wno-unused-variable")
end