mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
made several targets
This commit is contained in:
parent
82b08d0b7e
commit
06373c1aa1
133
default.bam
133
default.bam
|
@ -1,36 +1,5 @@
|
|||
--
|
||||
function copy(output, input)
|
||||
print("copy " .. PathFilename(output))
|
||||
local copy_command
|
||||
|
||||
if family == "windows" then
|
||||
copy_command = "copy"
|
||||
input = str_replace(input, "/", "\\")
|
||||
output = str_replace(output, "/", "\\")
|
||||
else
|
||||
copy_command = "cp"
|
||||
end
|
||||
|
||||
os.execute(copy_command .. " " .. input .. " " .. output)
|
||||
return 0
|
||||
end
|
||||
|
||||
function Copy(outputdir, ...)
|
||||
local inputs = collect_input(arg)
|
||||
local outputs = {}
|
||||
|
||||
-- compile all the files
|
||||
for index, inname in inputs do
|
||||
output = Path(outputdir .. "/" .. PathFilename(inname))
|
||||
input = Path(inname)
|
||||
bam_add_job("copy", output, input)
|
||||
bam_add_dependency(output, input)
|
||||
table.insert(outputs, output)
|
||||
end
|
||||
|
||||
return outputs
|
||||
end
|
||||
|
||||
-- data compiler
|
||||
dc_compiler = "python scripts/compiler.py"
|
||||
if family == "windows" then
|
||||
dc_compiler = "scripts\\compiler.py"
|
||||
|
@ -93,35 +62,6 @@ function DataCompile(datafile, scriptfile, headerfile, sourcefile, outputdatafil
|
|||
return {cdata = outputdatafile, header=headerfile, source=sourcefile}
|
||||
end
|
||||
|
||||
config_name = "debug"
|
||||
config_ext = ""
|
||||
|
||||
settings = NewSettings()
|
||||
settings.cc.debug = 1
|
||||
settings.cc.optimize = 0
|
||||
|
||||
if family == "windows" then
|
||||
settings.cc.flags = "/wd4244"
|
||||
else
|
||||
settings.cc.flags = "-Wall"
|
||||
settings.linker.flags = ""
|
||||
end
|
||||
|
||||
--settings.cc.output = function(input, extention)
|
||||
-- return Path("objs/" .. PathFilename(input) .. config_ext .. extention)
|
||||
--end
|
||||
|
||||
baselib_options = {}
|
||||
baselib_options.settings = settings
|
||||
baselib = Import("../baselib/baselib.bam", baselib_options)
|
||||
baselib.apply(settings, "all")
|
||||
|
||||
server_settings = NewSettings()
|
||||
baselib.apply(server_settings, "network")
|
||||
|
||||
settings.cc.includes:add("src")
|
||||
settings.cc.includes:add("../baselib/src/external/zlib")
|
||||
|
||||
serverdata = DataCompile(
|
||||
"datasrc/teewars.ds",
|
||||
"datasrc/server.dts",
|
||||
|
@ -133,14 +73,34 @@ clientdata = DataCompile(
|
|||
"datasrc/teewars.ds",
|
||||
"datasrc/client.dts",
|
||||
"src/game/client/data.h",
|
||||
"src/game/client/data/server_data.cpp",
|
||||
"src/game/client/data/server_internal.cpp")
|
||||
"src/game/client/data/client_data.cpp",
|
||||
"src/game/client/data/client_internal.cpp")
|
||||
|
||||
--clientdata = DataCompile("datasrc/teewars.ds", "datasrc/client.dts", "src/game/client/data.h", "src/game/client/data/client_data.cpp", "datasrc/client.dat")
|
||||
--internal_clientdata = Dat2c("datasrc/client.dat", "src/game/client/data/client_internal.cpp", "internal_client_data");
|
||||
--internal_serverdata = Dat2c("datasrc/server.dat", "src/game/server/data/server_internal.cpp", "internal_server_data");
|
||||
function build(settings)
|
||||
settings.objdir = Path("objs")
|
||||
|
||||
if family == "windows" then
|
||||
settings.cc.flags = "/wd4244"
|
||||
else
|
||||
settings.cc.flags = "-Wall"
|
||||
settings.linker.flags = ""
|
||||
end
|
||||
|
||||
server_settings = settings:copy()
|
||||
|
||||
basepath = Path("objs/baselib")
|
||||
baselib_options = {}
|
||||
baselib_options.settings = settings:copy()
|
||||
baselib_options.settings.objdir = Path("objs/baselib")
|
||||
baselib_options.settings.libdir = Path("objs/baselib")
|
||||
baselib = Import("../baselib/baselib.bam", baselib_options)
|
||||
|
||||
baselib.apply(settings, "all")
|
||||
baselib.apply(server_settings, "network")
|
||||
|
||||
settings.cc.includes:add("src")
|
||||
settings.cc.includes:add("../baselib/src/external/zlib")
|
||||
|
||||
function build(config)
|
||||
engine = Compile(settings, Collect("src/engine/*.cpp"))
|
||||
client = Compile(settings, Collect("src/engine/client/*.cpp", "src/engine/client/pnglite/*.c"))
|
||||
server = Compile(settings, Collect("src/engine/server/*.cpp"))
|
||||
|
@ -160,14 +120,37 @@ function build(config)
|
|||
tools[i] = Link(settings, toolname, v)
|
||||
end
|
||||
|
||||
client_exe = Link(settings, "teewars"..config_ext, engine, client, editor, game_shared, game_client)
|
||||
server_exe = Link(server_settings, "teewars_srv"..config_ext, engine, server, game_shared, game_server)
|
||||
masterserver_exe = Link(server_settings, "mastersrv"..config_ext, masterserver, engine)
|
||||
-- build client, server and master srever
|
||||
client_exe = Link(settings, "teewars", engine, client, editor, game_shared, game_client)
|
||||
server_exe = Link(server_settings, "teewars_srv", engine, server, game_shared, game_server)
|
||||
masterserver_exe = Link(server_settings, "mastersrv", masterserver, engine)
|
||||
|
||||
Target(PseudoTarget("client", client_exe))
|
||||
Target(PseudoTarget("server", server_exe))
|
||||
Target(PseudoTarget("masterserver", masterserver_exe))
|
||||
Target(PseudoTarget("tools", tools))
|
||||
-- make targets
|
||||
c = PseudoTarget("client".."_"..settings.config_name, client_exe)
|
||||
s = PseudoTarget("server".."_"..settings.config_name, server_exe)
|
||||
m = PseudoTarget("masterserver".."_"..settings.config_name, masterserver_exe)
|
||||
t = PseudoTarget("tools".."_"..settings.config_name, tools)
|
||||
Target(c)
|
||||
Target(s)
|
||||
Target(m)
|
||||
Target(t)
|
||||
all = PseudoTarget(settings.config_name, c, s, m, t)
|
||||
Target(all)
|
||||
return all
|
||||
end
|
||||
|
||||
build("debug")
|
||||
|
||||
debug_settings = NewSettings()
|
||||
debug_settings.config_name = "debug"
|
||||
debug_settings.config_ext = "_d"
|
||||
debug_settings.debug = 1
|
||||
debug_settings.cc.optimize = 0
|
||||
|
||||
release_settings = NewSettings()
|
||||
release_settings.config_name = "release"
|
||||
release_settings.config_ext = ""
|
||||
release_settings.debug = 0
|
||||
release_settings.cc.optimize = 1
|
||||
|
||||
DefaultTarget(build(debug_settings))
|
||||
build(release_settings)
|
||||
|
|
Loading…
Reference in a new issue