2016-06-18 22:14:13 +00:00
|
|
|
CheckVersion("0.5")
|
2008-10-21 12:34:33 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
Import("configure.lua")
|
2009-10-27 14:38:53 +00:00
|
|
|
Import("other/sdl/sdl.lua")
|
2010-05-29 07:25:38 +00:00
|
|
|
Import("other/freetype/freetype.lua")
|
2008-11-29 10:19:00 +00:00
|
|
|
|
2010-06-03 20:39:40 +00:00
|
|
|
--- Setup Config -------
|
2008-05-10 17:18:56 +00:00
|
|
|
config = NewConfig()
|
2009-10-27 14:38:53 +00:00
|
|
|
config:Add(OptCCompiler("compiler"))
|
2009-01-08 09:48:42 +00:00
|
|
|
config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all"))
|
2018-10-15 17:50:36 +00:00
|
|
|
config:Add(OptTestCompileC("minmacosxsdk", "int main(){return 0;}", "-mmacosx-version-min=10.7 -isysroot /Developer/SDKs/MacOSX10.7.sdk"))
|
2009-10-27 14:38:53 +00:00
|
|
|
config:Add(OptLibrary("zlib", "zlib.h", false))
|
2009-01-08 09:48:42 +00:00
|
|
|
config:Add(SDL.OptFind("sdl", true))
|
2010-05-29 07:25:38 +00:00
|
|
|
config:Add(FreeType.OptFind("freetype", true))
|
2010-05-29 10:22:18 +00:00
|
|
|
config:Finalize("config.lua")
|
2007-05-22 15:05:28 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
generated_src_dir = "build/src"
|
|
|
|
generated_icon_dir = "build/icons"
|
|
|
|
builddir = "build/%(arch)s/%(conf)s"
|
2015-01-18 17:44:11 +00:00
|
|
|
content_src_dir = "datasrc/"
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
2007-08-02 08:20:53 +00:00
|
|
|
-- data compiler
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function Python(name)
|
2008-06-12 10:51:48 +00:00
|
|
|
if family == "windows" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Python is usually registered for .py files in Windows
|
2008-06-12 10:51:48 +00:00
|
|
|
return str_replace(name, "/", "\\")
|
2008-04-20 22:30:59 +00:00
|
|
|
end
|
2008-06-12 10:51:48 +00:00
|
|
|
return "python " .. name
|
2008-02-24 16:03:58 +00:00
|
|
|
end
|
2007-08-22 21:13:33 +00:00
|
|
|
|
|
|
|
function CHash(output, ...)
|
2010-05-29 07:25:38 +00:00
|
|
|
local inputs = TableFlatten({...})
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
output = PathJoin(generated_src_dir, Path(output))
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2007-08-22 21:13:33 +00:00
|
|
|
-- compile all the files
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
local cmd = Python("scripts/cmd5.py") .. " "
|
2009-01-08 09:48:42 +00:00
|
|
|
for index, inname in ipairs(inputs) do
|
2011-04-13 18:37:12 +00:00
|
|
|
cmd = cmd .. Path(inname) .. " "
|
2007-08-22 21:13:33 +00:00
|
|
|
end
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
cmd = cmd .. " > " .. output
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2009-01-08 09:48:42 +00:00
|
|
|
AddJob(output, "cmd5 " .. output, cmd)
|
|
|
|
for index, inname in ipairs(inputs) do
|
|
|
|
AddDependency(output, inname)
|
2007-08-22 21:13:33 +00:00
|
|
|
end
|
2010-05-29 15:39:15 +00:00
|
|
|
AddDependency(output, "scripts/cmd5.py")
|
2007-08-22 21:13:33 +00:00
|
|
|
return output
|
|
|
|
end
|
|
|
|
|
2014-06-21 17:59:43 +00:00
|
|
|
function ResCompile(scriptfile, compiler)
|
2007-08-07 17:46:04 +00:00
|
|
|
scriptfile = Path(scriptfile)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
local output = nil
|
2014-06-21 17:59:43 +00:00
|
|
|
if compiler == "cl" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
output = PathJoin(generated_icon_dir, PathBase(PathFilename(scriptfile)) .. ".res")
|
2010-11-14 11:50:23 +00:00
|
|
|
AddJob(output, "rc " .. scriptfile, "rc /fo " .. output .. " " .. scriptfile)
|
2014-06-21 17:59:43 +00:00
|
|
|
elseif compiler == "gcc" or compiler == "clang" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
output = PathJoin(generated_icon_dir, PathBase(PathFilename(scriptfile)) .. ".coff")
|
2010-11-14 11:50:23 +00:00
|
|
|
AddJob(output, "windres " .. scriptfile, "windres -i " .. scriptfile .. " -o " .. output)
|
|
|
|
end
|
2009-01-08 09:48:42 +00:00
|
|
|
AddDependency(output, scriptfile)
|
2007-08-07 17:46:04 +00:00
|
|
|
return output
|
|
|
|
end
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
function ContentCompile(action, output)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
output = PathJoin(generated_src_dir, Path(output))
|
2009-01-08 09:48:42 +00:00
|
|
|
AddJob(
|
2008-06-12 10:51:48 +00:00
|
|
|
output,
|
|
|
|
action .. " > " .. output,
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
Python("datasrc/compile.py") .. " " .. action .. " > " .. output
|
2008-06-12 10:51:48 +00:00
|
|
|
)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
AddDependency(output, "datasrc/compile.py")
|
|
|
|
AddDependency("datasrc/compile.py", "datasrc/content.py", "datasrc/network.py", "datasrc/datatypes.py")
|
2008-06-12 10:51:48 +00:00
|
|
|
return output
|
2007-07-13 13:40:04 +00:00
|
|
|
end
|
2007-05-22 15:05:28 +00:00
|
|
|
|
2007-07-24 23:46:29 +00:00
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
function GenerateCommonSettings(settings, conf, arch, compiler)
|
2014-04-26 14:30:44 +00:00
|
|
|
if compiler == "gcc" or compiler == "clang" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.cc.flags:Add("-Wall", "-fno-exceptions")
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Compile zlib if needed
|
|
|
|
local zlib = nil
|
|
|
|
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
|
|
|
|
else
|
|
|
|
settings.cc.includes:Add("src/engine/external/zlib")
|
|
|
|
zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
|
|
|
|
end
|
2007-08-22 21:13:33 +00:00
|
|
|
|
2012-02-19 13:49:55 +00:00
|
|
|
local md5 = Compile(settings, Collect("src/engine/external/md5/*.c"))
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
local wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
|
|
|
|
local png = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
|
|
|
|
local json = Compile(settings, Collect("src/engine/external/json-parser/*.c"))
|
2007-08-22 21:13:33 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- globally available libs
|
2012-02-19 13:49:55 +00:00
|
|
|
libs = {zlib=zlib, wavpack=wavpack, png=png, md5=md5, json=json}
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
2009-01-11 12:57:29 +00:00
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
function GenerateMacOSXSettings(settings, conf, arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if arch == "x86" then
|
|
|
|
settings.cc.flags:Add("-arch i386")
|
|
|
|
settings.link.flags:Add("-arch i386")
|
|
|
|
elseif arch == "x86_64" then
|
|
|
|
settings.cc.flags:Add("-arch x86_64")
|
|
|
|
settings.link.flags:Add("-arch x86_64")
|
|
|
|
elseif arch == "ppc" then
|
|
|
|
settings.cc.flags:Add("-arch ppc")
|
|
|
|
settings.link.flags:Add("-arch ppc")
|
|
|
|
elseif arch == "ppc64" then
|
|
|
|
settings.cc.flags:Add("-arch ppc64")
|
|
|
|
settings.link.flags:Add("-arch ppc64")
|
2011-12-04 21:28:58 +00:00
|
|
|
else
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
print("Unknown Architecture '" .. arch .. "'. Supported: x86, x86_64, ppc, ppc64")
|
|
|
|
os.exit(1)
|
2011-12-04 21:28:58 +00:00
|
|
|
end
|
2009-01-08 09:48:42 +00:00
|
|
|
|
2019-01-04 21:07:35 +00:00
|
|
|
-- c++ stdlib needed
|
2018-10-15 17:50:36 +00:00
|
|
|
settings.cc.flags:Add("--stdlib=libc++")
|
|
|
|
settings.link.flags:Add("--stdlib=libc++")
|
|
|
|
-- this also needs the macOS min SDK version to be at least 10.7
|
|
|
|
|
|
|
|
settings.cc.flags:Add("-mmacosx-version-min=10.7")
|
|
|
|
settings.link.flags:Add("-mmacosx-version-min=10.7")
|
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if config.minmacosxsdk.value == 1 then
|
2018-10-15 17:50:36 +00:00
|
|
|
settings.cc.flags:Add("-isysroot /Developer/SDKs/MacOSX10.7.sdk")
|
|
|
|
settings.link.flags:Add("-isysroot /Developer/SDKs/MacOSX10.7.sdk")
|
2010-11-14 11:50:23 +00:00
|
|
|
end
|
2007-08-07 17:46:04 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.link.frameworks:Add("Carbon")
|
|
|
|
settings.link.frameworks:Add("AppKit")
|
2007-12-15 10:24:49 +00:00
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateCommonSettings(settings, conf, arch, compiler)
|
2009-01-08 09:48:42 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Build server launcher before adding game stuff
|
|
|
|
local serverlaunch = Link(settings, "serverlaunch", Compile(settings, "src/osxlaunch/server.m"))
|
2007-07-24 23:46:29 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Master server, version server and tools
|
|
|
|
BuildEngineCommon(settings)
|
|
|
|
BuildMasterserver(settings)
|
|
|
|
BuildVersionserver(settings)
|
|
|
|
BuildTools(settings)
|
2007-08-22 07:52:33 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Add requirements for Server & Client
|
|
|
|
BuildGameCommon(settings)
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Server
|
|
|
|
settings.link.frameworks:Add("Cocoa")
|
|
|
|
local server_exe = BuildServer(settings)
|
|
|
|
AddDependency(server_exe, serverlaunch)
|
|
|
|
|
|
|
|
-- Client
|
|
|
|
settings.link.frameworks:Add("OpenGL")
|
|
|
|
settings.link.frameworks:Add("AGL")
|
|
|
|
-- FIXME: the SDL config is applied in BuildClient too but is needed here before so the launcher will compile
|
|
|
|
config.sdl:Apply(settings)
|
2018-12-03 09:37:26 +00:00
|
|
|
settings.link.extrafiles:Merge(Compile(settings, "src/osxlaunch/client.m"))
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
BuildClient(settings)
|
2015-01-18 17:44:11 +00:00
|
|
|
|
|
|
|
-- Content
|
2019-01-05 22:25:15 +00:00
|
|
|
BuildContent(settings, arch, conf)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
function GenerateLinuxSettings(settings, conf, arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if arch == "x86" then
|
2018-12-12 09:49:14 +00:00
|
|
|
settings.cc.flags:Add("-msse2") -- for the _mm_pause call
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.cc.flags:Add("-m32")
|
|
|
|
settings.link.flags:Add("-m32")
|
|
|
|
elseif arch == "x86_64" then
|
|
|
|
settings.cc.flags:Add("-m64")
|
|
|
|
settings.link.flags:Add("-m64")
|
2017-09-11 15:51:07 +00:00
|
|
|
elseif arch == "armv7l" then
|
|
|
|
-- arm 32 bit
|
2008-05-10 17:18:56 +00:00
|
|
|
else
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
print("Unknown Architecture '" .. arch .. "'. Supported: x86, x86_64")
|
|
|
|
os.exit(1)
|
2008-05-10 17:18:56 +00:00
|
|
|
end
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.link.libs:Add("pthread")
|
2008-05-10 17:18:56 +00:00
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateCommonSettings(settings, conf, arch, compiler)
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Master server, version server and tools
|
|
|
|
BuildEngineCommon(settings)
|
|
|
|
BuildTools(settings)
|
|
|
|
BuildMasterserver(settings)
|
|
|
|
BuildVersionserver(settings)
|
2007-10-02 08:26:08 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Add requirements for Server & Client
|
|
|
|
BuildGameCommon(settings)
|
|
|
|
|
|
|
|
-- Server
|
|
|
|
BuildServer(settings)
|
|
|
|
|
|
|
|
-- Client
|
|
|
|
settings.link.libs:Add("X11")
|
|
|
|
settings.link.libs:Add("GL")
|
|
|
|
settings.link.libs:Add("GLU")
|
|
|
|
BuildClient(settings)
|
2015-01-18 17:44:11 +00:00
|
|
|
|
|
|
|
-- Content
|
2019-01-05 22:25:15 +00:00
|
|
|
BuildContent(settings, arch, conf)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
function GenerateSolarisSettings(settings, conf, arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.link.libs:Add("socket")
|
|
|
|
settings.link.libs:Add("nsl")
|
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateLinuxSettings(settings, conf, arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function GenerateWindowsSettings(settings, conf, target_arch, compiler)
|
|
|
|
if compiler == "cl" then
|
|
|
|
if (target_arch == "x86" and arch ~= "ia32") or
|
2018-10-21 09:33:29 +00:00
|
|
|
(target_arch == "x86_64" and arch ~= "ia64" and arch ~= "amd64") then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
print("Cross compiling is unsupported on Windows.")
|
|
|
|
os.exit(1)
|
|
|
|
end
|
2015-12-22 17:33:08 +00:00
|
|
|
settings.cc.flags:Add("/wd4244", "/wd4577")
|
2014-04-26 14:30:44 +00:00
|
|
|
elseif compiler == "gcc" or config.compiler.driver == "clang" then
|
2015-08-30 14:57:13 +00:00
|
|
|
if target_arch ~= "x86" and target_arch ~= "x86_64" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
print("Unknown Architecture '" .. arch .. "'. Supported: x86, x86_64")
|
|
|
|
os.exit(1)
|
2007-10-02 08:26:08 +00:00
|
|
|
end
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- disable visibility attribute support for gcc on windows
|
|
|
|
settings.cc.defines:Add("NO_VIZ")
|
2014-03-23 11:15:09 +00:00
|
|
|
settings.cc.defines:Add("_WIN32_WINNT=0x0501")
|
2008-05-10 17:18:56 +00:00
|
|
|
end
|
2008-10-21 16:31:19 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
local icons = SharedIcons(compiler)
|
|
|
|
|
|
|
|
-- Required libs
|
|
|
|
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")
|
2015-06-21 15:47:37 +00:00
|
|
|
settings.link.libs:Add("advapi32")
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateCommonSettings(settings, conf, target_arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
|
|
|
-- Master server, version server and tools
|
|
|
|
BuildEngineCommon(settings)
|
|
|
|
BuildMasterserver(settings)
|
|
|
|
BuildVersionserver(settings)
|
|
|
|
BuildTools(settings)
|
|
|
|
|
|
|
|
-- Add requirements for Server & Client
|
|
|
|
BuildGameCommon(settings)
|
|
|
|
|
|
|
|
-- Server
|
|
|
|
local server_settings = settings:Copy()
|
|
|
|
server_settings.link.extrafiles:Add(icons.server)
|
|
|
|
BuildServer(server_settings)
|
|
|
|
|
|
|
|
-- Client
|
|
|
|
settings.link.extrafiles:Add(icons.client)
|
|
|
|
settings.link.libs:Add("opengl32")
|
|
|
|
settings.link.libs:Add("glu32")
|
|
|
|
settings.link.libs:Add("winmm")
|
|
|
|
BuildClient(settings)
|
2015-01-18 17:44:11 +00:00
|
|
|
|
|
|
|
-- Content
|
2019-01-05 22:25:15 +00:00
|
|
|
BuildContent(settings, target_arch, conf)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function SharedCommonFiles()
|
|
|
|
-- Shared game files, generate only once
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if not shared_common_files then
|
|
|
|
local network_source = ContentCompile("network_source", "generated/protocol.cpp")
|
|
|
|
local network_header = ContentCompile("network_header", "generated/protocol.h")
|
2018-12-02 10:34:26 +00:00
|
|
|
AddDependency(network_source, network_header, "src/engine/shared/protocol.h")
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
|
|
|
local nethash = CHash("generated/nethash.cpp", "src/engine/shared/protocol.h", "src/game/tuning.h", "src/game/gamecore.cpp", network_header)
|
|
|
|
shared_common_files = {network_source, nethash}
|
2007-07-24 22:53:43 +00:00
|
|
|
end
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
return shared_common_files
|
|
|
|
end
|
2007-10-02 08:26:08 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function SharedServerFiles()
|
|
|
|
-- Shared server files, generate only once
|
2009-01-12 20:04:14 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if not shared_server_files then
|
|
|
|
local server_content_source = ContentCompile("server_content_source", "generated/server_data.cpp")
|
|
|
|
local server_content_header = ContentCompile("server_content_header", "generated/server_data.h")
|
|
|
|
AddDependency(server_content_source, server_content_header)
|
|
|
|
shared_server_files = {server_content_source}
|
2009-01-12 20:04:14 +00:00
|
|
|
end
|
2011-04-13 18:37:12 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
return shared_server_files
|
|
|
|
end
|
|
|
|
|
|
|
|
function SharedClientFiles()
|
|
|
|
-- Shared client files, generate only once
|
2007-10-02 08:26:08 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if not shared_client_files then
|
|
|
|
local client_content_source = ContentCompile("client_content_source", "generated/client_data.cpp")
|
|
|
|
local client_content_header = ContentCompile("client_content_header", "generated/client_data.h")
|
|
|
|
AddDependency(client_content_source, client_content_header)
|
|
|
|
shared_client_files = {client_content_source}
|
|
|
|
end
|
|
|
|
|
|
|
|
return shared_client_files
|
|
|
|
end
|
2007-08-02 08:20:53 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
shared_icons = {}
|
|
|
|
function SharedIcons(compiler)
|
|
|
|
if not shared_icons[compiler] then
|
2014-06-21 17:59:43 +00:00
|
|
|
local server_icon = ResCompile("other/icons/teeworlds_srv_" .. compiler .. ".rc", compiler)
|
|
|
|
local client_icon = ResCompile("other/icons/teeworlds_" .. compiler .. ".rc", compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
shared_icons[compiler] = {server=server_icon, client=client_icon}
|
|
|
|
end
|
|
|
|
return shared_icons[compiler]
|
|
|
|
end
|
2009-01-08 09:48:42 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function BuildEngineCommon(settings)
|
|
|
|
settings.link.extrafiles:Merge(Compile(settings, Collect("src/engine/shared/*.cpp", "src/base/*.c")))
|
|
|
|
end
|
2007-12-19 18:47:47 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function BuildGameCommon(settings)
|
|
|
|
settings.link.extrafiles:Merge(Compile(settings, Collect("src/game/*.cpp"), SharedCommonFiles()))
|
2007-07-21 18:07:27 +00:00
|
|
|
end
|
2007-05-22 15:05:28 +00:00
|
|
|
|
2009-01-21 22:59:52 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function BuildClient(settings, family, platform)
|
|
|
|
config.sdl:Apply(settings)
|
|
|
|
config.freetype:Apply(settings)
|
2011-11-13 00:29:19 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
local client = Compile(settings, Collect("src/engine/client/*.cpp"))
|
|
|
|
|
|
|
|
local game_client = Compile(settings, CollectRecursive("src/game/client/*.cpp"), SharedClientFiles())
|
|
|
|
local game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))
|
|
|
|
|
2012-02-19 13:49:55 +00:00
|
|
|
Link(settings, "teeworlds", libs["zlib"], libs["md5"], libs["wavpack"], libs["png"], libs["json"], client, game_client, game_editor)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function BuildServer(settings, family, platform)
|
|
|
|
local server = Compile(settings, Collect("src/engine/server/*.cpp"))
|
|
|
|
|
|
|
|
local game_server = Compile(settings, CollectRecursive("src/game/server/*.cpp"), SharedServerFiles())
|
|
|
|
|
2012-02-19 13:49:55 +00:00
|
|
|
return Link(settings, "teeworlds_srv", libs["zlib"], libs["md5"], server, game_server)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
2011-11-13 00:29:19 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function BuildTools(settings)
|
|
|
|
local tools = {}
|
|
|
|
for i,v in ipairs(Collect("src/tools/*.cpp", "src/tools/*.c")) do
|
|
|
|
local toolname = PathFilename(PathBase(v))
|
2012-07-04 19:12:15 +00:00
|
|
|
tools[i] = Link(settings, toolname, Compile(settings, v), libs["zlib"], libs["md5"], libs["wavpack"], libs["png"])
|
2011-11-13 00:29:19 +00:00
|
|
|
end
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
PseudoTarget(settings.link.Output(settings, "pseudo_tools") .. settings.link.extension, tools)
|
|
|
|
end
|
|
|
|
|
|
|
|
function BuildMasterserver(settings)
|
2012-07-04 19:12:15 +00:00
|
|
|
return Link(settings, "mastersrv", Compile(settings, Collect("src/mastersrv/*.cpp")), libs["zlib"], libs["md5"])
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function BuildVersionserver(settings)
|
2012-07-04 19:12:15 +00:00
|
|
|
return Link(settings, "versionsrv", Compile(settings, Collect("src/versionsrv/*.cpp")), libs["zlib"], libs["md5"])
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
end
|
|
|
|
|
2019-01-05 22:25:15 +00:00
|
|
|
function BuildContent(settings, arch, conf)
|
2015-01-18 17:44:11 +00:00
|
|
|
local content = {}
|
2015-01-20 18:52:39 +00:00
|
|
|
table.insert(content, CopyToDir(settings.link.Output(settings, "data"), CollectRecursive(content_src_dir .. "*.png", content_src_dir .. "*.wv", content_src_dir .. "*.ttf", content_src_dir .. "*.txt", content_src_dir .. "*.map", content_src_dir .. "*.rules", content_src_dir .. "*.json")))
|
2019-01-05 22:25:15 +00:00
|
|
|
if family == "windows" then
|
|
|
|
if arch == "x86_64" then
|
|
|
|
_arch = "64"
|
|
|
|
else
|
|
|
|
_arch = "32"
|
|
|
|
end
|
|
|
|
-- dependencies
|
|
|
|
dl = Python("scripts/download.py")
|
|
|
|
AddJob("other/sdl/include/SDL.h", "Downloading SDL2", dl .. " sdl")
|
|
|
|
AddJob("other/freetype/include/ft2build.h", "Downloading freetype", dl .. " freetype")
|
|
|
|
table.insert(content, CopyFile(settings.link.Output(settings, "") .. "/SDL2.dll", "other/sdl/windows/lib" .. _arch .. "/SDL2.dll"))
|
|
|
|
table.insert(content, CopyFile(settings.link.Output(settings, "") .. "/freetype.dll", "other/freetype/windows/lib" .. _arch .. "/freetype.dll"))
|
|
|
|
AddDependency(settings.link.Output(settings, "") .. "/SDL2.dll", "other/sdl/include/SDL.h")
|
|
|
|
AddDependency(settings.link.Output(settings, "") .. "/freetype.dll", "other/freetype/include/ft2build.h")
|
|
|
|
end
|
2015-01-18 17:44:11 +00:00
|
|
|
PseudoTarget(settings.link.Output(settings, "content") .. settings.link.extension, content)
|
|
|
|
end
|
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- create all targets for specified configuration & architecture
|
|
|
|
function GenerateSettings(conf, arch, builddir, compiler)
|
|
|
|
local settings = NewSettings()
|
2011-11-13 00:29:19 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
-- Set compiler if explicitly requested
|
|
|
|
if compiler == "gcc" then
|
|
|
|
SetDriversGCC(settings)
|
2014-04-26 14:30:44 +00:00
|
|
|
elseif compiler == "clang" then
|
|
|
|
SetDriversClang(settings)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
elseif compiler == "cl" then
|
|
|
|
SetDriversCL(settings)
|
|
|
|
else
|
2017-10-03 17:01:27 +00:00
|
|
|
-- apply compiler settings
|
|
|
|
config.compiler:Apply(settings)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
compiler = config.compiler.driver
|
|
|
|
end
|
2011-11-13 00:29:19 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if conf == "debug" then
|
|
|
|
settings.debug = 1
|
|
|
|
settings.optimize = 0
|
|
|
|
settings.cc.defines:Add("CONF_DEBUG")
|
2011-11-13 00:29:19 +00:00
|
|
|
else
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.debug = 0
|
|
|
|
settings.optimize = 1
|
|
|
|
settings.cc.defines:Add("CONF_RELEASE")
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Generate object files in {builddir}/objs/
|
|
|
|
settings.cc.Output = function (settings_, input)
|
|
|
|
-- strip
|
|
|
|
input = input:gsub("^src/", "")
|
|
|
|
input = input:gsub("^" .. generated_src_dir .. "/", "")
|
|
|
|
return PathJoin(PathJoin(builddir, "objs"), PathBase(input))
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Build output files in {builddir}
|
|
|
|
settings.link.Output = function (settings_, input)
|
|
|
|
return PathJoin(builddir, PathBase(input) .. settings_.config_ext)
|
|
|
|
end
|
|
|
|
|
|
|
|
settings.cc.includes:Add("src")
|
2018-11-26 19:47:20 +00:00
|
|
|
settings.cc.includes:Add("src/engine/external/pnglite")
|
|
|
|
settings.cc.includes:Add("src/engine/external/wavpack")
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
settings.cc.includes:Add(generated_src_dir)
|
|
|
|
|
|
|
|
if family == "windows" then
|
|
|
|
GenerateWindowsSettings(settings, conf, arch, compiler)
|
|
|
|
elseif family == "unix" then
|
|
|
|
if platform == "macosx" then
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateMacOSXSettings(settings, conf, arch, compiler)
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
elseif platform == "solaris" then
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateSolarisSettings(settings, conf, arch, compiler)
|
2015-11-06 20:33:24 +00:00
|
|
|
else -- Linux, BSD
|
2017-08-21 21:09:43 +00:00
|
|
|
GenerateLinuxSettings(settings, conf, arch, compiler)
|
2012-10-07 13:35:33 +00:00
|
|
|
end
|
2011-11-13 00:29:19 +00:00
|
|
|
end
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
|
|
|
return settings
|
|
|
|
end
|
|
|
|
|
2015-05-19 14:50:28 +00:00
|
|
|
-- String formatting with named parameters, by RiciLake http://lua-users.org/wiki/StringInterpolation
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function interp(s, tab)
|
|
|
|
return (s:gsub('%%%((%a%w*)%)([-0-9%.]*[cdeEfgGiouxXsq])',
|
|
|
|
function(k, fmt)
|
|
|
|
return tab[k] and ("%"..fmt):format(tab[k]) or '%('..k..')'..fmt
|
|
|
|
end))
|
|
|
|
end
|
|
|
|
|
2015-01-18 17:44:11 +00:00
|
|
|
function CopyToDir(dst, ...)
|
|
|
|
local output = {}
|
|
|
|
for filename in TableWalk({...}) do
|
|
|
|
table.insert(output, CopyFile(PathJoin(dst, string.sub(filename, string.len(content_src_dir)+1)), filename))
|
|
|
|
end
|
|
|
|
return output
|
|
|
|
end
|
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
function split(str, sep)
|
|
|
|
local vals = {}
|
|
|
|
str:gsub("([^,]+)", function(val) table.insert(vals, val) end)
|
|
|
|
return vals
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Supported archtitectures: x86, amd64, ppc, ppc64
|
|
|
|
if ScriptArgs['arch'] then
|
|
|
|
archs = split(ScriptArgs['arch'])
|
2009-01-11 12:10:30 +00:00
|
|
|
else
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
if arch == "ia32" then
|
|
|
|
archs = {"x86"}
|
2018-10-21 09:33:29 +00:00
|
|
|
elseif arch == "ia64" or arch == "amd64" then
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
archs = {"x86_64"}
|
|
|
|
else
|
|
|
|
archs = {arch}
|
|
|
|
end
|
2009-01-11 12:10:30 +00:00
|
|
|
end
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
|
|
|
if ScriptArgs['conf'] then
|
|
|
|
confs = split(ScriptArgs['conf'])
|
|
|
|
else
|
|
|
|
confs = {"debug"}
|
|
|
|
end
|
|
|
|
|
|
|
|
if ScriptArgs['compiler'] then
|
|
|
|
compiler = ScriptArgs['compiler']
|
|
|
|
else
|
|
|
|
compiler = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
if ScriptArgs['builddir'] then
|
|
|
|
builddir = ScriptArgs['builddir']
|
|
|
|
end
|
|
|
|
|
|
|
|
targets = {client="teeworlds", server="teeworlds_srv",
|
|
|
|
versionserver="versionsrv", masterserver="mastersrv",
|
2015-01-18 17:44:11 +00:00
|
|
|
tools="pseudo_tools", content="content"}
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
|
|
|
|
subtargets = {}
|
|
|
|
for t, cur_target in pairs(targets) do
|
|
|
|
subtargets[cur_target] = {}
|
|
|
|
end
|
|
|
|
for a, cur_arch in ipairs(archs) do
|
|
|
|
for c, cur_conf in ipairs(confs) do
|
|
|
|
cur_builddir = interp(builddir, {platform=family, arch=cur_arch, target=cur_target, conf=cur_conf, compiler=compiler})
|
|
|
|
local settings = GenerateSettings(cur_conf, cur_arch, cur_builddir, compiler)
|
|
|
|
for t, cur_target in pairs(targets) do
|
|
|
|
table.insert(subtargets[cur_target], PathJoin(cur_builddir, cur_target .. settings.link.extension))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-05-19 14:50:28 +00:00
|
|
|
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
for cur_name, cur_target in pairs(targets) do
|
|
|
|
-- Supertarget for all configurations and architectures of that target
|
|
|
|
PseudoTarget(cur_name, subtargets[cur_target])
|
|
|
|
end
|
|
|
|
|
2015-01-18 17:44:11 +00:00
|
|
|
PseudoTarget("game", "client", "server", "content")
|
rewrote bam.lua to be cleaner
bam invocation changed: bam compiler=[cl,gcc] arch=[x86,x86_64,ppc,ppc64] conf=[release,debug] [game,server,client,masterserver,versionserver,tools]
using pkg-config for SDL instead of sdl-config if available because of crosscompiling issues
by default binaries will only built for the current architecture on Mac OS X now, like on all other systems
2013-02-26 20:48:44 +00:00
|
|
|
DefaultTarget("game")
|