Files
Blitz/xmake.lua

98 lines
1.9 KiB
Lua

-- We need that for the tests
set_xmakever("2.8.5")
set_policy("package.install_locally", true)
add_rules("mode.debug", "mode.release", "mode.valgrind")
add_requires("libsdl 2.28.3", {configs = {sdlmain = false}})
add_requires("glbinding >= 3", "zlib", "assimp", "nlohmann_json")
set_languages("c++17")
add_includedirs("include")
-- Game files (with server)
target("Blitz")
if is_os("windows") then
set_kind("static")
add_links("ws2_32") -- link network stuff
else
set_kind("shared")
end
add_files("src/blitz/**.cpp", "src/server/**.cpp")
add_packages("zlib")
-- Server binary (headless)
target("BlitzServer")
set_kind("binary")
set_default(false)
add_files("src/ServerMain.cpp")
-- Libraries
add_deps("Blitz")
-- Client binary (default)
target("BlitzClient")
if is_plat("android") then
set_kind("shared")
else
set_kind("binary")
end
set_default(true)
add_files("src/client/**.cpp", "src/ClientMain.cpp")
-- Libraries
add_deps("Blitz")
add_packages("libsdl", "glbinding", "assimp", "nlohmann_json")
add_includedirs("libs", "libs/imgui")
add_files("libs/imgui/**.cpp")
if is_plat("macosx") then
add_frameworks("OpenGL")
elseif is_plat("windows") then
add_ldflags("/LTCG") -- fix compiltation of glbinding
end
-- Assets
set_rundir("$(projectdir)/assets")
-- Valgrind test
if is_mode("valgrind") then
on_run(function (target)
os.cd("$(projectdir)/assets")
os.execv("valgrind", {target:targetfile()})
end)
end
-- Tests
for _, file in ipairs(os.files("test/test_*.cpp")) do
local name = path.basename(file)
target(name)
set_kind("binary")
add_files("test/" .. name .. ".cpp")
set_default(false)
add_deps("Blitz")
add_tests("compile_and_run")
end