ddnet/default.bam

174 lines
5.8 KiB
Plaintext
Raw Normal View History

2007-05-22 15:05:28 +00:00
--
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
dc_compiler = "python scripts/compiler.py"
2007-07-13 21:20:57 +00:00
if family == "windows" then
dc_compiler = "scripts\\compiler.py"
end
dat2c_compiler = "python scripts/dat2c.py"
if family == "windows" then
dat2c_compiler = "scripts\\dat2c.py"
end
function dat2c(output, data, name)
print("dat2c " .. PathFilename(output) .. " = " .. PathFilename(data))
return os.execute(dat2c_compiler .. " " .. data .. " " .. name .. " > " .. output)
end
2007-07-13 13:40:04 +00:00
function dc_header(output, data, script)
print("dc_header " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script))
2007-07-13 21:20:57 +00:00
return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -h " .. output)
2007-07-13 13:40:04 +00:00
end
function dc_source(output, data, script)
print("dc_source " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script))
2007-07-13 21:20:57 +00:00
return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -s " .. output)
2007-07-13 13:40:04 +00:00
end
function dc_data(output, data, script)
print("dc_data " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script))
2007-07-13 21:20:57 +00:00
return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -d " .. output)
2007-07-13 13:40:04 +00:00
end
function dc_cdata(output, data, script)
print("dc_cdata " .. PathFilename(output) .. " = " .. PathFilename(data) .. " ~ " .. PathFilename(script))
return os.execute(dc_compiler .. " " .. data .. " " .. script .. " -c " .. output)
end
function Dat2c(datafile, sourcefile, arrayname)
2007-07-13 13:40:04 +00:00
datafile = Path(datafile)
sourcefile = Path(sourcefile)
bam_add_job("dat2c", sourcefile, datafile, arrayname)
bam_add_dependency(sourcefile, datafile)
return sourcefile
2007-07-13 13:40:04 +00:00
end
function DataCompile(datafile, scriptfile, headerfile, sourcefile, outputdatafile)
datafile = Path(datafile)
scriptfile = Path(scriptfile)
headerfile = Path(headerfile)
sourcefile = Path(sourcefile)
outputdatafile = Path(outputdatafile)
bam_add_job("dc_source", sourcefile, datafile, scriptfile)
bam_add_job("dc_header", headerfile, datafile, scriptfile)
bam_add_job("dc_cdata", outputdatafile, datafile, scriptfile)
2007-07-13 13:40:04 +00:00
bam_add_dependency(sourcefile, datafile)
bam_add_dependency(sourcefile, scriptfile)
bam_add_dependency(sourcefile, headerfile)
bam_add_dependency(headerfile, datafile)
bam_add_dependency(headerfile, scriptfile)
bam_add_dependency(outputdatafile, datafile)
bam_add_dependency(outputdatafile, scriptfile)
return {cdata = outputdatafile, header=headerfile, source=sourcefile}
2007-07-13 13:40:04 +00:00
end
2007-05-22 15:05:28 +00:00
config_name = "debug"
config_ext = ""
2007-05-22 15:05:28 +00:00
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
2007-07-21 18:09:53 +00:00
--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")
2007-05-22 15:05:28 +00:00
serverdata = DataCompile(
"datasrc/teewars.ds",
"datasrc/server.dts",
"src/game/server/data.h",
"src/game/server/data/server_data.cpp",
"src/game/server/data/server_internal.cpp")
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")
--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(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"))
masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
game_shared = Compile(settings, Collect("src/game/*.cpp"))
game_client = Compile(settings, Collect("src/game/client/*.cpp"), clientdata.source, clientdata.cdata)
game_server = Compile(settings, Collect("src/game/server/*.cpp"), serverdata.source, serverdata.cdata)
editor = Compile(settings, Collect("src/editor/*.cpp"))
-- build tools
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
objs = Compile(settings, tools_src)
tools = {}
for i,v in objs do
toolname = PathFilename(file_base(v))
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)
Target(PseudoTarget("client", client_exe))
Target(PseudoTarget("server", server_exe))
Target(PseudoTarget("masterserver", masterserver_exe))
Target(PseudoTarget("tools", tools))
end
2007-05-22 15:05:28 +00:00
build("debug")