Files
Tower-Defense/xmake.lua
2023-08-13 11:59:13 +02:00

73 lines
1.9 KiB
Lua

add_rules("mode.debug", "mode.release")
add_defines("TD_IMPL_OPENGL_LOADER_GLEW")
add_requires("libsdl >= 2", "zlib", "glew")
target("TowerDefense")
set_kind("static")
add_includedirs("include")
add_files("src/td/**.cpp")
set_languages("c++17")
add_packages("zlib")
add_links("pthread")
add_cxflags("-pthread")
if is_os("windows") then
add_links("ws2_32") -- link network stuff
end
if is_mode("release") then
-- mark symbols visibility as hidden
set_symbols("hidden")
-- strip all symbols
add_ldflags("-s")
set_warnings("all", "error")
set_optimize("fastest")
else -- debug stuff
if is_os("linux") then
add_links("dw")
end
if is_os("windows") then
add_links("dbghelp", "psapi", "kernel32", "msvcr90")
end
add_cxflags("-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=1 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused")
end
target("TowerDefenseServer")
add_deps("TowerDefense")
set_kind("binary")
add_files("src/ServerMain.cpp", "src/server/**.cpp")
add_includedirs("include")
target("TowerDefenseClient")
add_deps("TowerDefense")
set_kind("binary")
add_files("src/ClientMain.cpp", "src/client/**.cpp", "src/server/**.cpp")
add_includedirs("include")
add_packages("libsdl", "glew", "opengl")
-- run windows program with wine on linux
if is_host("linux") and is_os("windows") then
on_run(function(target)
os.cd("test")
os.execv("wine", {target:targetfile()})
end)
end