Added bam.lua changes by SushiTee

This commit is contained in:
GreYFoXGTi 2010-12-01 20:52:00 +02:00
parent c149b17617
commit 4c4544da12
10 changed files with 101 additions and 368 deletions

9
.gitignore vendored
View file

@ -28,4 +28,11 @@ DDRace_Trunk_d*
*.patch
*.prefs
*.lnk
*.pdb
*.pdb
*.sdf
*.sln
*.suo
*.vcxproj
*.filters
*.user
*.cmd

View file

@ -1,327 +0,0 @@
CheckVersion("0.4")
Import("configure.lua")
Import("other/sdl/sdl.lua")
Import("other/freetype/freetype.lua")
--- Setup Config -------
config = NewConfig()
config:Add(OptCCompiler("compiler"))
config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all"))
config:Add(OptLibrary("zlib", "zlib.h", false))
config:Add(SDL.OptFind("sdl", true))
config:Add(FreeType.OptFind("freetype", true))
config:Finalize("config.lua")
-- data compiler
function Script(name)
if family == "windows" then
return str_replace(name, "/", "\\")
end
return "python " .. name
end
function CHash(output, ...)
local inputs = TableFlatten({...})
output = Path(output)
-- compile all the files
local cmd = Script("scripts/cmd5.py") .. " "
for index, inname in ipairs(inputs) do
cmd = cmd .. Path(inname) .. " "
end
cmd = cmd .. " > " .. output
AddJob(output, "cmd5 " .. output, cmd)
for index, inname in ipairs(inputs) do
AddDependency(output, inname)
end
AddDependency(output, "scripts/cmd5.py")
return output
end
--[[
function DuplicateDirectoryStructure(orgpath, srcpath, dstpath)
for _,v in pairs(CollectDirs(srcpath .. "/")) do
MakeDirectory(dstpath .. "/" .. string.sub(v, string.len(orgpath)+2))
DuplicateDirectoryStructure(orgpath, v, dstpath)
end
end
DuplicateDirectoryStructure("src", "src", "objs")
]]
function ResCompile(scriptfile)
scriptfile = Path(scriptfile)
if config.compiler.driver == "cl" then
output = PathBase(scriptfile) .. ".res"
AddJob(output, "rc " .. scriptfile, "rc /fo " .. output .. " " .. scriptfile)
elseif config.compiler.driver == "gcc" then
output = PathBase(scriptfile) .. ".coff"
AddJob(output, "windres " .. scriptfile, "windres -i " .. scriptfile .. " -o " .. output)
end
AddDependency(output, scriptfile)
return output
end
function Dat2c(datafile, sourcefile, arrayname)
datafile = Path(datafile)
sourcefile = Path(sourcefile)
AddJob(
sourcefile,
"dat2c " .. PathFilename(sourcefile) .. " = " .. PathFilename(datafile),
Script("scripts/dat2c.py").. "\" " .. sourcefile .. " " .. datafile .. " " .. arrayname
)
AddDependency(sourcefile, datafile)
return sourcefile
end
function ContentCompile(action, output)
output = Path(output)
AddJob(
output,
action .. " > " .. output,
--Script("datasrc/compile.py") .. "\" ".. Path(output) .. " " .. action
Script("datasrc/compile.py") .. " " .. action .. " > " .. Path(output)
)
AddDependency(output, Path("datasrc/content.py")) -- do this more proper
AddDependency(output, Path("datasrc/network.py"))
AddDependency(output, Path("datasrc/compile.py"))
AddDependency(output, Path("datasrc/datatypes.py"))
return output
end
-- Content Compile
network_source = ContentCompile("network_source", "src/game/generated/protocol.cpp")
network_header = ContentCompile("network_header", "src/game/generated/protocol.h")
client_content_source = ContentCompile("client_content_source", "src/game/generated/client_data.cpp")
client_content_header = ContentCompile("client_content_header", "src/game/generated/client_data.h")
server_content_source = ContentCompile("server_content_source", "src/game/generated/server_data.cpp")
server_content_header = ContentCompile("server_content_header", "src/game/generated/server_data.h")
AddDependency(network_source, network_header)
AddDependency(client_content_source, client_content_header)
AddDependency(server_content_source, server_content_header)
nethash = CHash("src/game/generated/nethash.c", "src/engine/shared/protocol.h", "src/game/generated/protocol.h", "src/game/tuning.h", "src/game/gamecore.cpp", network_header)
client_link_other = {}
client_depends = {}
if family == "windows" then
table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
if config.compiler.driver == "cl" then
client_link_other = {ResCompile("other/icons/teeworlds_cl.rc")}
elseif config.compiler.driver == "gcc" then
client_link_other = {ResCompile("other/icons/teeworlds_gcc.rc")}
end
end
function Intermediate_Output(settings, input)
return "objs/" .. string.sub(PathBase(input), string.len("src/")+1) .. settings.config_ext
end
function build(settings)
--settings.objdir = Path("objs")
settings.cc.Output = Intermediate_Output
if config.compiler.driver == "cl" then
settings.cc.flags:Add("/wd4244")
settings.cc.flags:Add("/EHsc")
else
settings.cc.flags:Add("-Wall")
if platform == "macosx" then
settings.cc.flags:Add("-mmacosx-version-min=10.4", "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
settings.link.flags:Add("-mmacosx-version-min=10.4", "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
elseif config.stackprotector.value == 1 then
settings.cc.flags:Add("-fstack-protector", "-fstack-protector-all")
settings.link.flags:Add("-fstack-protector", "-fstack-protector-all")
end
end
-- set some platform specific settings
settings.cc.includes:Add("src")
if family == "unix" then
if platform == "macosx" then
settings.link.frameworks:Add("Carbon")
settings.link.frameworks:Add("AppKit")
else
settings.link.libs:Add("pthread")
end
elseif family == "windows" then
settings.link.flags:Add("/FORCE:MULTIPLE")
settings.link.libs:Add("gdi32")
settings.link.libs:Add("user32")
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
end
-- compile zlib if needed
if config.zlib.value == 1 then
settings.link.libs:Add("z")
if config.zlib.include_path then
settings.cc.includes:Add(config.zlib.include_path)
end
zlib = {}
else
zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
settings.cc.includes:Add("src/engine/external/zlib")
end
-- build the small libraries
wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
-- build game components
engine_settings = settings:Copy()
server_settings = engine_settings:Copy()
client_settings = engine_settings:Copy()
launcher_settings = engine_settings:Copy()
if family == "unix" then
if platform == "macosx" then
client_settings.link.frameworks:Add("OpenGL")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
else
client_settings.link.libs:Add("X11")
client_settings.link.libs:Add("GL")
client_settings.link.libs:Add("GLU")
end
elseif family == "windows" then
client_settings.link.libs:Add("opengl32")
client_settings.link.libs:Add("glu32")
client_settings.link.libs:Add("winmm")
end
-- apply sdl settings
config.sdl:Apply(client_settings)
-- apply freetype settings
config.freetype:Apply(client_settings)
engine = Compile(engine_settings, Collect("src/engine/shared/*.cpp", "src/base/*.c"))
client = Compile(client_settings, Collect("src/engine/client/*.cpp"))
server = Compile(server_settings, Collect("src/engine/server/*.cpp"))
versionserver = Compile(settings, Collect("src/versionsrv/*.cpp"))
masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, network_source)
game_client = Compile(settings, CollectRecursive("src/game/client/*.cpp"), client_content_source)
game_server = Compile(settings, CollectRecursive("src/game/server/*.cpp"), server_content_source)
game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))
-- build tools (TODO: fix this so we don't get double _d_d stuff)
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
client_osxlaunch = {}
server_osxlaunch = {}
if platform == "macosx" then
client_osxlaunch = Compile(client_settings, "src/osxlaunch/client.m")
server_osxlaunch = Compile(launcher_settings, "src/osxlaunch/server.m")
end
tools = {}
for i,v in ipairs(tools_src) do
toolname = PathFilename(PathBase(v))
tools[i] = Link(settings, toolname, Compile(settings, v), engine, zlib)
end
-- build client, server, version server and master server
client_exe = Link(client_settings, "DDRace_Trunk-Client", game_shared, game_client,
engine, client, game_editor, zlib, pnglite, wavpack,
client_link_other, client_osxlaunch)
server_exe = Link(server_settings, "DDRace_Trunk-Server", engine, server,
game_shared, game_server, zlib)
serverlaunch = {}
if platform == "macosx" then
serverlaunch = Link(launcher_settings, "serverlaunch", server_osxlaunch)
end
versionserver_exe = Link(server_settings, "versionsrv", versionserver,
engine, zlib)
masterserver_exe = Link(server_settings, "mastersrv", masterserver,
engine, zlib)
-- make targets
c = PseudoTarget("client".."_"..settings.config_name, client_exe, client_depends)
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_depends)
g = PseudoTarget("game".."_"..settings.config_name, client_exe, server_exe)
v = PseudoTarget("versionserver".."_"..settings.config_name, versionserver_exe)
m = PseudoTarget("masterserver".."_"..settings.config_name, masterserver_exe)
t = PseudoTarget("tools".."_"..settings.config_name, tools)
all = PseudoTarget(settings.config_name, c, s, v, m, t)
return all
end
debug_settings = NewSettings()
debug_settings.config_name = "debug"
debug_settings.config_ext = "_d"
debug_settings.debug = 1
debug_settings.optimize = 0
debug_settings.cc.defines:Add("CONF_DEBUG")
release_settings = NewSettings()
release_settings.config_name = "release"
release_settings.config_ext = ""
release_settings.debug = 0
release_settings.optimize = 1
release_settings.cc.defines:Add("CONF_RELEASE")
if platform == "macosx" and arch == "ia32" then
debug_settings_ppc = debug_settings:Copy()
debug_settings_ppc.config_name = "debug_ppc"
debug_settings_ppc.config_ext = "_ppc_d"
debug_settings_ppc.cc.flags:Add("-arch ppc")
debug_settings_ppc.link.flags:Add("-arch ppc")
debug_settings_ppc.cc.defines:Add("CONF_DEBUG")
release_settings_ppc = release_settings:Copy()
release_settings_ppc.config_name = "release_ppc"
release_settings_ppc.config_ext = "_ppc"
release_settings_ppc.cc.flags:Add("-arch ppc")
release_settings_ppc.link.flags:Add("-arch ppc")
release_settings_ppc.cc.defines:Add("CONF_RELEASE")
debug_settings_x86 = debug_settings:Copy()
debug_settings_x86.config_name = "debug_x86"
debug_settings_x86.config_ext = "_x86_d"
debug_settings_x86.cc.defines:Add("CONF_DEBUG")
release_settings_x86 = release_settings:Copy()
release_settings_x86.config_name = "release_x86"
release_settings_x86.config_ext = "_x86"
release_settings_x86.cc.defines:Add("CONF_RELEASE")
ppc_d = build(debug_settings_ppc)
x86_d = build(debug_settings_x86)
ppc_r = build(release_settings_ppc)
x86_r = build(release_settings_x86)
DefaultTarget("game_debug_x86")
PseudoTarget("release", ppc_r, x86_r)
PseudoTarget("debug", ppc_d, x86_d)
PseudoTarget("server_release", "server_release_x86", "server_release_ppc")
PseudoTarget("server_debug", "server_debug_x86", "server_debug_ppc")
PseudoTarget("client_release", "client_release_x86", "client_release_ppc")
PseudoTarget("client_debug", "client_debug_x86", "client_debug_ppc")
else
build(debug_settings)
build(release_settings)
DefaultTarget("game_debug")
end

131
bam.lua
View file

@ -16,7 +16,7 @@ config:Finalize("config.lua")
-- data compiler
function Script(name)
if family == "windows" then
return str_replace(name, "/", "\\")
return str_replace(name, "/", "\\")
end
return "python " .. name
end
@ -110,13 +110,13 @@ nethash = CHash("src/game/generated/nethash.c", "src/engine/shared/protocol.h",
client_link_other = {}
client_depends = {}
server_depends = {}
server_sql_depends = {}
if family == "windows" then
table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
table.insert(server_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\mysqlcppconn.dll"))
table.insert(server_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\libmysql.dll"))
table.insert(server_sql_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\mysqlcppconn.dll"))
table.insert(server_sql_depends, CopyToDirectory(".", "other\\mysql\\vc2005libs\\libmysql.dll"))
if config.compiler.driver == "cl" then
client_link_other = {ResCompile("other/icons/teeworlds_cl.rc")}
elseif config.compiler.driver == "gcc" then
@ -138,8 +138,8 @@ function build(settings)
else
settings.cc.flags:Add("-Wall")
if platform == "macosx" then
settings.cc.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.6.sdk")
settings.link.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.6.sdk")
settings.cc.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.sdk", "-arch i386")
settings.link.flags:Add("-mmacosx-version-min=10.5", "-isysroot /Developer/SDKs/MacOSX10.5.sdk", "-arch i386")
elseif config.stackprotector.value == 1 then
settings.cc.flags:Add("-fstack-protector", "-fstack-protector-all")
settings.link.flags:Add("-fstack-protector", "-fstack-protector-all")
@ -148,38 +148,21 @@ function build(settings)
-- set some platform specific settings
settings.cc.includes:Add("src")
settings.cc.includes:Add("other/mysql/include")
if family == "unix" then
if family == "unix" then
if platform == "macosx" then
settings.link.frameworks:Add("Carbon")
settings.link.frameworks:Add("AppKit")
settings.cc.includes:Add("/usr/local/mysql/include")
settings.cc.includes:Add("/usr/local/mysql/include/cppconn")
settings.link.libpath:Add("/usr/local/mysql/lib")
settings.link.libs:Add("mysqlcppconn-static")
settings.link.libs:Add("mysqlclient")
else
settings.link.libs:Add("pthread")
settings.cc.includes:Add("other/mysql/include")
settings.cc.includes:Add("other/mysql/include/cppconn")
if arch == "amd64" then
settings.link.libpath:Add("other/mysql/lib64")
else
settings.link.libpath:Add("other/mysql/lib32")
end
settings.link.libs:Add("mysqlcppconn-static")
settings.link.libs:Add("mysqlclient")
end
elseif family == "windows" then
settings.link.flags:Add("/FORCE:MULTIPLE")
settings.link.libs:Add("gdi32")
settings.link.libs:Add("user32")
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
settings.cc.includes:Add("other/mysql/include")
settings.link.libpath:Add("other/mysql/vc2005libs")
settings.link.libs:Add("mysqlcppconn")
end
-- compile zlib if needed
@ -205,22 +188,41 @@ function build(settings)
launcher_settings = engine_settings:Copy()
if family == "unix" then
if string.find(settings.config_name, "sql") then
server_settings.link.libs:Add("mysqlcppconn-static")
server_settings.link.libs:Add("mysqlclient")
end
if platform == "macosx" then
client_settings.link.frameworks:Add("OpenGL")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
client_settings.link.frameworks:Add("AGL")
client_settings.link.frameworks:Add("Carbon")
client_settings.link.frameworks:Add("Cocoa")
launcher_settings.link.frameworks:Add("Cocoa")
if string.find(settings.config_name, "sql") then
server_settings.link.libpath:Add("other/mysql/mac/lib32")
end
else
client_settings.link.libs:Add("X11")
client_settings.link.libs:Add("GL")
client_settings.link.libs:Add("GLU")
if string.find(settings.config_name, "sql") then
if arch == "amd64" then
server_settings.link.libpath:Add("other/mysql/linux/lib64")
else
server_settings.link.libpath:Add("other/mysql/linux/lib32")
end
end
end
elseif family == "windows" then
client_settings.link.libs:Add("opengl32")
client_settings.link.libs:Add("glu32")
client_settings.link.libs:Add("winmm")
if string.find(settings.config_name, "sql") then
server_settings.link.libpath:Add("other/mysql/vc2005libs")
server_settings.link.libs:Add("mysqlcppconn")
end
end
-- apply sdl settings
@ -276,7 +278,11 @@ function build(settings)
-- make targets
c = PseudoTarget("client".."_"..settings.config_name, client_exe, client_depends)
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_depends)
if string.find(settings.config_name, "sql") then
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch, server_sql_depends)
else
s = PseudoTarget("server".."_"..settings.config_name, server_exe, serverlaunch)
end
g = PseudoTarget("game".."_"..settings.config_name, client_exe, server_exe)
v = PseudoTarget("versionserver".."_"..settings.config_name, versionserver_exe)
@ -293,14 +299,28 @@ debug_settings.config_name = "debug"
debug_settings.config_ext = "_d"
debug_settings.debug = 1
debug_settings.optimize = 0
debug_settings.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_settings.cc.defines:Add("CONF_DEBUG")
debug_sql_settings = NewSettings()
debug_sql_settings.config_name = "sql_debug"
debug_sql_settings.config_ext = "_sql_d"
debug_sql_settings.debug = 1
debug_sql_settings.optimize = 0
debug_sql_settings.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
release_settings = NewSettings()
release_settings.config_name = "release"
release_settings.config_ext = ""
release_settings.debug = 0
release_settings.optimize = 1
release_settings.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_settings.cc.defines:Add("CONF_RELEASE")
release_sql_settings = NewSettings()
release_sql_settings.config_name = "sql_release"
release_sql_settings.config_ext = "_sql"
release_sql_settings.debug = 0
release_sql_settings.optimize = 1
release_sql_settings.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
if platform == "macosx" and arch == "ia32" then
debug_settings_ppc = debug_settings:Copy()
@ -308,40 +328,73 @@ if platform == "macosx" and arch == "ia32" then
debug_settings_ppc.config_ext = "_ppc_d"
debug_settings_ppc.cc.flags:Add("-arch ppc")
debug_settings_ppc.link.flags:Add("-arch ppc")
debug_settings_ppc.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_settings_ppc.cc.defines:Add("CONF_DEBUG")
debug_sql_settings_ppc = debug_sql_settings:Copy()
debug_sql_settings_ppc.config_name = "sql_debug_ppc"
debug_sql_settings_ppc.config_ext = "_sql_ppc_d"
debug_sql_settings_ppc.cc.flags:Add("-arch ppc")
debug_sql_settings_ppc.link.flags:Add("-arch ppc")
debug_sql_settings_ppc.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
release_settings_ppc = release_settings:Copy()
release_settings_ppc.config_name = "release_ppc"
release_settings_ppc.config_ext = "_ppc"
release_settings_ppc.cc.flags:Add("-arch ppc")
release_settings_ppc.link.flags:Add("-arch ppc")
release_settings_ppc.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_settings_ppc.cc.defines:Add("CONF_RELEASE")
release_sql_settings_ppc = release_sql_settings:Copy()
release_sql_settings_ppc.config_name = "sql_release_ppc"
release_sql_settings_ppc.config_ext = "_sql_ppc"
release_sql_settings_ppc.cc.flags:Add("-arch ppc")
release_sql_settings_ppc.link.flags:Add("-arch ppc")
release_sql_settings_ppc.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
debug_settings_x86 = debug_settings:Copy()
debug_settings_x86.config_name = "debug_x86"
debug_settings_x86.config_ext = "_x86_d"
debug_settings_x86.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
debug_settings_x86.cc.defines:Add("CONF_DEBUG")
debug_sql_settings_x86 = debug_sql_settings:Copy()
debug_sql_settings_x86.config_name = "sql_debug_x86"
debug_sql_settings_x86.config_ext = "_sql_x86_d"
debug_sql_settings_x86.cc.defines:Add("CONF_DEBUG", "CONF_SQL")
release_settings_x86 = release_settings:Copy()
release_settings_x86.config_name = "release_x86"
release_settings_x86.config_ext = "_x86"
release_settings_x86.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
release_settings_x86.cc.defines:Add("CONF_RELEASE")
release_sql_settings_x86 = release_sql_settings:Copy()
release_sql_settings_x86.config_name = "sql_release_x86"
release_sql_settings_x86.config_ext = "_sql_x86"
release_sql_settings_x86.cc.defines:Add("CONF_RELEASE", "CONF_SQL")
ppc_d = build(debug_settings_ppc)
x86_d = build(debug_settings_x86)
sql_ppc_d = build(debug_sql_settings_ppc)
sql_x86_d = build(debug_sql_settings_x86)
ppc_r = build(release_settings_ppc)
x86_r = build(release_settings_x86)
sql_ppc_r = build(release_sql_settings_ppc)
sql_x86_r = build(release_sql_settings_x86)
DefaultTarget("game_debug_x86")
PseudoTarget("release", ppc_r, x86_r)
PseudoTarget("sql_release", sql_ppc_r, sql_x86_r)
PseudoTarget("debug", ppc_d, x86_d)
PseudoTarget("sql_debug", sql_ppc_d, sql_x86_d)
PseudoTarget("server_release", "server_release_x86", "server_release_ppc")
PseudoTarget("server_sql_release", "server_sql_release_x86", "server_sql_release_ppc")
PseudoTarget("server_debug", "server_debug_x86", "server_debug_ppc")
PseudoTarget("server_sql_debug", "server_sql_debug_x86", "server_sql_debug_ppc")
PseudoTarget("client_release", "client_release_x86", "client_release_ppc")
PseudoTarget("client_debug", "client_debug_x86", "client_debug_ppc")
else
build(debug_settings)
build(debug_sql_settings)
build(release_settings)
build(release_sql_settings)
DefaultTarget("game_debug")
end
end

View file

@ -35,7 +35,7 @@
/* #undef HAVE_UINT32_T */
/* #undef HAVE_INT64_T */
/* #undef HAVE_UINT64_T */
//#define HAVE_MS_INT8 1
#define HAVE_MS_INT8 1
#define HAVE_MS_UINT8 1
#define HAVE_MS_INT16 1
#define HAVE_MS_UINT16 1

Binary file not shown.

Binary file not shown.