2008-10-21 12:34:33 +00:00
|
|
|
CheckVersion("0.1")
|
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
--- Setup Config --------
|
|
|
|
config = NewConfig()
|
|
|
|
config:add(OptFindCompiler())
|
|
|
|
config:add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all"))
|
|
|
|
config:add(OptFindLibrary("zlib", "zlib.h", false))
|
|
|
|
config:add(OptFindLibrary("glfw", "glfw.h", false))
|
|
|
|
config:add(OptFindLibrary("portaudio", "portaudio.h_FAIL", false))
|
|
|
|
|
|
|
|
config:add(OptFindLibrary("coreaudio", "AudioUnit/AudioUnit.h", false))
|
|
|
|
config:add(OptFindLibrary("alsa", "alsa/asoundlib.h", false))
|
|
|
|
config:add(OptFindLibrary("oss_sys", "sys/soundcard.h", false))
|
|
|
|
config:add(OptFindLibrary("oss_linux", "linux/soundcard.h", false))
|
|
|
|
config:add(OptFindLibrary("oss_machine", "machine/soundcard.h", false))
|
|
|
|
config:add(OptFindLibrary("dsound", "dsound.h", true))
|
|
|
|
|
2008-10-21 15:34:42 +00:00
|
|
|
function OptFindSDL(name, required)
|
|
|
|
local check = function(option)
|
|
|
|
option.value = nil
|
|
|
|
option.use_sdlconfig = nil
|
2008-10-21 16:31:19 +00:00
|
|
|
option.use_win32sdl = nil
|
2008-10-21 15:34:42 +00:00
|
|
|
option.lib_path = nil
|
|
|
|
|
|
|
|
if ExecuteSilent("sdl-config") > 0 and ExecuteSilent("sdl-config --cflags") == 0 then
|
|
|
|
option.value = 1
|
|
|
|
option.use_sdlconfig = 1
|
|
|
|
end
|
|
|
|
|
2008-10-21 16:31:19 +00:00
|
|
|
if platform == "win32" then
|
|
|
|
option.value = 1
|
|
|
|
option.use_win32sdl = 1
|
|
|
|
end
|
|
|
|
|
2008-10-21 16:16:16 +00:00
|
|
|
if platform == "macosx" then
|
|
|
|
option.value = 1
|
|
|
|
end
|
2008-10-21 15:34:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local apply = function(option, settings)
|
|
|
|
if option.use_sdlconfig then
|
|
|
|
settings.cc.flags = settings.cc.flags .. " -I/usr/include/SDL "
|
|
|
|
settings.linker.flags = settings.linker.flags .. " `sdl-config --libs` "
|
|
|
|
else
|
2008-10-21 16:16:16 +00:00
|
|
|
if platform == "macosx" then
|
|
|
|
client_settings.linker.frameworks:add("SDL")
|
|
|
|
client_settings.cc.includes:add("/Library/Frameworks/SDL.framework/Headers")
|
|
|
|
end
|
2008-10-21 15:34:42 +00:00
|
|
|
end
|
2008-10-21 16:31:19 +00:00
|
|
|
|
|
|
|
if option.use_win32sdl then
|
|
|
|
settings.cc.includes:add("other/sdl_include")
|
|
|
|
settings.linker.libpath:add("other/vc2005_sdllibs")
|
|
|
|
settings.linker.libs:add("SDL")
|
|
|
|
settings.linker.libs:add("SDLmain")
|
|
|
|
end
|
2008-10-21 15:34:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local save = function(option, output)
|
|
|
|
output:option(option, "value")
|
|
|
|
output:option(option, "use_sdlconfig")
|
2008-10-21 16:31:19 +00:00
|
|
|
output:option(option, "use_win32sdl")
|
2008-10-21 15:34:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local display = function(option)
|
|
|
|
if option.value then
|
|
|
|
if option.use_sdlconfig then
|
|
|
|
return "using sdl-config"
|
2008-10-21 16:31:19 +00:00
|
|
|
end
|
|
|
|
if option.use_win32sdl then
|
|
|
|
return "using supplied win32 libraries"
|
2008-10-21 15:34:42 +00:00
|
|
|
end
|
|
|
|
else
|
|
|
|
if option.required then
|
|
|
|
return "not found (required)"
|
|
|
|
else
|
|
|
|
return "not found (optional)"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local o = MakeOption(name, 0, check, save, display)
|
|
|
|
o.apply = apply
|
|
|
|
o.include_path = nil
|
|
|
|
o.lib_path = nil
|
|
|
|
o.required = required
|
|
|
|
return o
|
|
|
|
end
|
|
|
|
|
|
|
|
config:add(OptFindSDL("sdl", false))
|
|
|
|
|
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
--- Auto detect ------
|
|
|
|
if not config:load("config.bam") then
|
|
|
|
print("--- Auto Configuration ---")
|
|
|
|
config:autodetect()
|
|
|
|
config:save("config.bam")
|
|
|
|
print("--- ")
|
|
|
|
end
|
2007-05-22 15:05:28 +00:00
|
|
|
|
2007-08-02 08:20:53 +00:00
|
|
|
-- data compiler
|
2008-06-12 10:51:48 +00:00
|
|
|
function Script(name)
|
|
|
|
if family == "windows" then
|
|
|
|
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
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
--dc_compiler = Script("scripts/compiler.py")
|
|
|
|
--netobj_compiler = Script("scripts/netobj.py")
|
|
|
|
dat2c_compiler = Script("scripts/dat2c.py")
|
|
|
|
cmd5_tool = Script("scripts/cmd5.py")
|
|
|
|
content_compiler = Script("datasrc/compile.py")
|
2008-04-20 22:30:59 +00:00
|
|
|
|
2007-08-22 21:13:33 +00:00
|
|
|
function CHash(output, ...)
|
|
|
|
local inputs = {}
|
|
|
|
local ih = collect_input(arg)
|
|
|
|
|
|
|
|
output = Path(output)
|
|
|
|
|
|
|
|
-- compile all the files
|
2008-06-12 10:51:48 +00:00
|
|
|
local cmd = cmd5_tool .. " "
|
2007-08-22 21:13:33 +00:00
|
|
|
for index, inname in ih do
|
2008-06-12 10:51:48 +00:00
|
|
|
cmd = cmd .. Path(inname) .. " "
|
2007-08-22 21:13:33 +00:00
|
|
|
end
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
cmd = cmd .. " > " .. output
|
|
|
|
|
|
|
|
bam_add_job(output, "cmd5 " .. output, cmd)
|
2007-08-22 21:13:33 +00:00
|
|
|
for index, inname in inputs do
|
|
|
|
bam_add_dependency(output, inname)
|
|
|
|
end
|
|
|
|
return output
|
|
|
|
end
|
|
|
|
|
2007-08-07 17:46:04 +00:00
|
|
|
function ResCompile(scriptfile)
|
|
|
|
scriptfile = Path(scriptfile)
|
|
|
|
output = PathBase(scriptfile) .. ".res"
|
2008-06-12 10:51:48 +00:00
|
|
|
bam_add_job(output, "rc " .. scriptfile, "rc /fo " .. output .. " " .. scriptfile)
|
2007-08-07 17:46:04 +00:00
|
|
|
bam_add_dependency(output, scriptfile)
|
|
|
|
return output
|
|
|
|
end
|
|
|
|
|
2007-07-24 22:53:43 +00:00
|
|
|
function Dat2c(datafile, sourcefile, arrayname)
|
2007-07-13 13:40:04 +00:00
|
|
|
datafile = Path(datafile)
|
2007-07-24 22:53:43 +00:00
|
|
|
sourcefile = Path(sourcefile)
|
2008-06-12 10:51:48 +00:00
|
|
|
|
|
|
|
bam_add_job(
|
|
|
|
sourcefile,
|
|
|
|
"dat2c " .. PathFilename(sourcefile) .. " = " .. PathFilename(datafile),
|
|
|
|
dat2c_compiler .. " " .. datafile .. " " .. arrayname .. " > " .. sourcefile
|
|
|
|
)
|
2007-07-24 22:53:43 +00:00
|
|
|
bam_add_dependency(sourcefile, datafile)
|
|
|
|
return sourcefile
|
2007-07-13 13:40:04 +00:00
|
|
|
end
|
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
function ContentCompile(action, output)
|
|
|
|
output = Path(output)
|
|
|
|
bam_add_job(
|
|
|
|
output,
|
|
|
|
action .. " > " .. output,
|
|
|
|
Script("datasrc/compile.py") .. " " .. action .. " > " .. Path(output)
|
|
|
|
)
|
|
|
|
bam_add_dependency(output, Path("datasrc/content.py")) -- do this more proper
|
|
|
|
bam_add_dependency(output, Path("datasrc/network.py"))
|
|
|
|
bam_add_dependency(output, Path("datasrc/compile.py"))
|
|
|
|
bam_add_dependency(output, Path("datasrc/datatypes.py"))
|
|
|
|
return output
|
2007-07-13 13:40:04 +00:00
|
|
|
end
|
2007-05-22 15:05:28 +00:00
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
-- Content Compile
|
|
|
|
network_source = ContentCompile("network_source", "src/game/generated/g_protocol.cpp")
|
2008-06-12 12:09:34 +00:00
|
|
|
network_header = ContentCompile("network_header", "src/game/generated/g_protocol.hpp")
|
2008-06-12 10:51:48 +00:00
|
|
|
client_content_source = ContentCompile("client_content_source", "src/game/generated/gc_data.cpp")
|
2008-06-12 12:09:34 +00:00
|
|
|
client_content_header = ContentCompile("client_content_header", "src/game/generated/gc_data.hpp")
|
2008-06-12 10:51:48 +00:00
|
|
|
server_content_source = ContentCompile("server_content_source", "src/game/generated/gs_data.cpp")
|
2008-06-12 12:09:34 +00:00
|
|
|
server_content_header = ContentCompile("server_content_header", "src/game/generated/gs_data.hpp")
|
2007-07-24 23:46:29 +00:00
|
|
|
|
2008-06-12 10:51:48 +00:00
|
|
|
bam_add_dependency(network_source, network_header)
|
|
|
|
bam_add_dependency(client_content_source, client_content_header)
|
|
|
|
bam_add_dependency(server_content_source, server_content_header)
|
2007-08-22 21:13:33 +00:00
|
|
|
|
2007-12-15 13:36:31 +00:00
|
|
|
nethash = CHash(
|
|
|
|
"src/game/generated/nethash.c",
|
|
|
|
"src/engine/e_protocol.h",
|
2008-06-12 12:09:34 +00:00
|
|
|
"src/game/generated/g_protocol.hpp",
|
2008-08-17 08:52:24 +00:00
|
|
|
"src/game/tuning.hpp",
|
|
|
|
"src/game/gamecore.cpp", network_header)
|
2007-08-22 21:13:33 +00:00
|
|
|
|
2007-08-07 17:46:04 +00:00
|
|
|
client_link_other = {}
|
2008-05-10 17:18:56 +00:00
|
|
|
if config.compiler.value == "cl" then
|
2008-03-22 18:40:27 +00:00
|
|
|
client_link_other = {ResCompile("other/icons/teeworlds.rc")}
|
2007-08-07 17:46:04 +00:00
|
|
|
end
|
|
|
|
|
2008-10-19 09:40:08 +00:00
|
|
|
function intermediate_output_func(dir, input, settings)
|
2007-12-15 10:24:49 +00:00
|
|
|
if not (dir == "") then
|
2008-10-19 09:47:20 +00:00
|
|
|
return Path(dir .. "/" .. PathBase(PathFilename(input)) .. settings.config_ext)
|
2007-12-15 10:24:49 +00:00
|
|
|
end
|
2008-10-19 09:47:20 +00:00
|
|
|
return PathBase(input) .. settings.config_ext
|
2007-12-15 10:24:49 +00:00
|
|
|
end
|
|
|
|
|
2007-08-02 08:20:53 +00:00
|
|
|
function build(settings)
|
|
|
|
settings.objdir = Path("objs")
|
2007-12-15 10:24:49 +00:00
|
|
|
settings.cc.output = intermediate_output_func
|
2008-10-20 17:47:42 +00:00
|
|
|
|
2008-10-21 12:34:33 +00:00
|
|
|
use_sdl = config.sdl.value
|
2008-10-21 16:31:19 +00:00
|
|
|
if use_sdl == 0 then use_sdl = nil end
|
2008-10-20 17:47:42 +00:00
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
if config.compiler.value == "cl" then
|
2007-08-02 08:20:53 +00:00
|
|
|
settings.cc.flags = "/wd4244"
|
2008-10-20 16:18:02 +00:00
|
|
|
settings.linker.flags = ""
|
2007-08-02 08:20:53 +00:00
|
|
|
else
|
2008-05-10 17:18:56 +00:00
|
|
|
settings.cc.flags = "-Wall -fno-exceptions "
|
2007-08-02 08:20:53 +00:00
|
|
|
settings.linker.flags = ""
|
2008-10-20 16:18:02 +00:00
|
|
|
if platform == "macosx" then
|
|
|
|
settings.cc.flags = settings.cc.flags .. " -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
|
|
|
|
settings.linker.flags = settings.linker.flags .. " -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
|
|
|
|
elseif config.stackprotector.value == 1 then
|
|
|
|
settings.cc.flags = settings.cc.flags .. " -fstack-protector -fstack-protector-all"
|
|
|
|
end
|
2007-08-02 08:20:53 +00:00
|
|
|
end
|
2007-07-24 23:46:29 +00:00
|
|
|
|
2007-08-22 07:52:33 +00:00
|
|
|
-- set some platform specific settings
|
2007-08-02 08:20:53 +00:00
|
|
|
settings.cc.includes:add("src")
|
2007-08-22 07:52:33 +00:00
|
|
|
|
|
|
|
if family == "unix" then
|
|
|
|
if platform == "macosx" then
|
|
|
|
glfw_platform = "macosx"
|
2008-03-05 19:38:47 +00:00
|
|
|
pa_platform = "mac_osx"
|
2008-10-02 14:37:48 +00:00
|
|
|
settings.linker.frameworks:add("Carbon")
|
|
|
|
settings.linker.frameworks:add("AppKit")
|
2007-08-22 07:52:33 +00:00
|
|
|
else
|
|
|
|
glfw_platform = "x11"
|
2008-03-05 19:38:47 +00:00
|
|
|
pa_platform = "unix"
|
2007-08-22 07:52:33 +00:00
|
|
|
settings.linker.libs:add("pthread")
|
|
|
|
end
|
|
|
|
elseif family == "windows" then
|
|
|
|
glfw_platform = "win32"
|
2008-03-05 19:38:47 +00:00
|
|
|
pa_platform = "win"
|
2008-05-10 17:18:56 +00:00
|
|
|
settings.linker.libs:add("gdi32")
|
|
|
|
settings.linker.libs:add("user32")
|
|
|
|
settings.linker.libs:add("ws2_32")
|
|
|
|
settings.linker.libs:add("ole32")
|
|
|
|
settings.linker.libs:add("shell32")
|
2007-08-22 07:52:33 +00:00
|
|
|
end
|
|
|
|
|
2008-10-20 17:47:42 +00:00
|
|
|
if use_sdl then
|
2008-05-10 17:18:56 +00:00
|
|
|
glfw = {}
|
2008-10-20 17:47:42 +00:00
|
|
|
portaudio = {}
|
2008-05-10 17:18:56 +00:00
|
|
|
else
|
2008-10-20 17:47:42 +00:00
|
|
|
settings.cc.defines:add("CONFIG_NO_SDL")
|
2008-03-05 19:38:47 +00:00
|
|
|
|
2008-10-20 17:47:42 +00:00
|
|
|
-- build glfw if needed (not tested)
|
|
|
|
if config.glfw.value == 1 then
|
|
|
|
settings.linker.libs:add("glfw")
|
|
|
|
if config.glfw.include_path then
|
|
|
|
settings.cc.includes:add(config.glfw.include_path)
|
|
|
|
end
|
|
|
|
glfw = {}
|
|
|
|
else
|
|
|
|
glfw_settings = settings:copy()
|
|
|
|
glfw_settings.cc.includes:add("src/external/glfw/include")
|
|
|
|
glfw_settings.cc.includes:add("src/engine/external/glfw/lib")
|
|
|
|
glfw_settings.cc.includes:add("src/engine/external/glfw/lib/" .. glfw_platform)
|
|
|
|
|
|
|
|
glfw = Compile(glfw_settings, Collect(
|
|
|
|
"src/engine/external/glfw/lib/*.c",
|
|
|
|
"src/engine/external/glfw/lib/" .. glfw_platform .. "/*.c"))
|
|
|
|
|
|
|
|
settings.cc.includes:add("src/engine/external/glfw/include")
|
2008-05-10 17:18:56 +00:00
|
|
|
end
|
|
|
|
|
2008-10-20 17:47:42 +00:00
|
|
|
-- build portaudio
|
|
|
|
if config.portaudio.value == 1 then
|
|
|
|
settings.linker.libs:add("portaudio")
|
|
|
|
if config.portaudio.include_path then
|
|
|
|
settings.cc.includes:add(config.portaudio.include_path)
|
|
|
|
end
|
|
|
|
portaudio = {}
|
2008-05-10 17:18:56 +00:00
|
|
|
else
|
2008-10-20 17:47:42 +00:00
|
|
|
pa_settings = settings:copy()
|
|
|
|
|
|
|
|
pa_hostapis = {}
|
|
|
|
if config.alsa.value == 1 then pa_hostapis["alsa"] = 1 end
|
|
|
|
if config.dsound.value == 1 then
|
|
|
|
pa_hostapis["dsound"] = 1
|
|
|
|
else
|
|
|
|
pa_settings.cc.defines:add("PA_NO_DS")
|
|
|
|
end
|
|
|
|
if config.coreaudio.value == 1 then pa_hostapis["coreaudio"] = 1 end
|
|
|
|
|
|
|
|
if config.oss_sys.value == 1 then
|
|
|
|
pa_hostapis["oss"] = 1
|
|
|
|
pa_settings.cc.defines:add("HAVE_SYS_SOUNDCARD_H")
|
|
|
|
elseif config.oss_linux.value == 1 then
|
|
|
|
pa_hostapis["oss"] = 1
|
|
|
|
pa_settings.cc.defines:add("HAVE_LINUX_SOUNDCARD_H")
|
|
|
|
elseif config.oss_machine.value == 1 then
|
|
|
|
pa_hostapis["oss"] = 1
|
|
|
|
pa_settings.cc.defines:add("HAVE_MACHINE_SOUNDCARD_H")
|
|
|
|
end
|
|
|
|
|
|
|
|
pa_settings.cc.defines:add("PA_NO_WMME")
|
|
|
|
pa_settings.cc.defines:add("PA_NO_ASIO")
|
|
|
|
pa_settings.cc.includes:add("src/engine/external/portaudio/include")
|
|
|
|
pa_settings.cc.includes:add("src/engine/external/portaudio/src/common")
|
|
|
|
pa_settings.cc.includes:add("src/engine/external/portaudio/src/os/" .. pa_platform)
|
|
|
|
|
|
|
|
pa_api_files = {}
|
|
|
|
for api,v in pa_hostapis do
|
|
|
|
pa_settings.cc.defines:add("PA_USE_"..string.upper(api))
|
|
|
|
pa_api_files[api] = Collect("src/engine/external/portaudio/src/hostapi/" .. api .. "/*.c")
|
|
|
|
end
|
|
|
|
|
|
|
|
portaudio = Compile(pa_settings,
|
|
|
|
Collect("src/engine/external/portaudio/src/common/*.c"),
|
|
|
|
Collect("src/engine/external/portaudio/src/os/" .. pa_platform .. "/*.c"),
|
|
|
|
pa_api_files)
|
|
|
|
|
|
|
|
settings.cc.includes:add("src/engine/external/portaudio/include")
|
|
|
|
end
|
2008-05-10 17:18:56 +00:00
|
|
|
end
|
2008-03-05 19:38:47 +00:00
|
|
|
|
2008-10-20 17:47:42 +00:00
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
-- compile zlib if needed
|
|
|
|
if config.zlib.value == 1 then
|
|
|
|
settings.linker.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"))
|
2008-03-05 19:38:47 +00:00
|
|
|
|
2008-03-22 18:40:27 +00:00
|
|
|
-- build game components
|
2007-08-22 07:52:33 +00:00
|
|
|
engine_settings = settings:copy()
|
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
if config.compiler.value == "cl" then
|
2007-10-06 17:01:06 +00:00
|
|
|
engine_settings.cc.flags = "/wd4244"
|
2007-08-22 07:52:33 +00:00
|
|
|
else
|
2008-10-21 15:34:42 +00:00
|
|
|
if platform == "macosx" then
|
2008-10-20 16:18:02 +00:00
|
|
|
engine_settings.cc.flags = "-Wall -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
|
|
|
|
engine_settings.linker.flags = "-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
|
2007-10-07 20:27:28 +00:00
|
|
|
else
|
2008-10-21 15:34:42 +00:00
|
|
|
engine_settings.cc.flags = "-Wall"
|
2008-10-20 16:18:02 +00:00
|
|
|
engine_settings.linker.flags = ""
|
2007-10-07 20:27:28 +00:00
|
|
|
end
|
2007-08-22 07:52:33 +00:00
|
|
|
end
|
2007-10-02 08:26:08 +00:00
|
|
|
|
|
|
|
-- server
|
|
|
|
server_settings = engine_settings:copy()
|
|
|
|
|
|
|
|
-- client
|
|
|
|
client_settings = engine_settings:copy()
|
|
|
|
|
|
|
|
if family == "unix" then
|
|
|
|
if platform == "macosx" then
|
|
|
|
client_settings.linker.frameworks:add("OpenGL")
|
|
|
|
client_settings.linker.frameworks:add("AGL")
|
|
|
|
client_settings.linker.frameworks:add("Carbon")
|
2007-12-19 18:47:47 +00:00
|
|
|
client_settings.linker.frameworks:add("Cocoa")
|
2008-05-10 17:18:56 +00:00
|
|
|
|
|
|
|
if config.coreaudio.value == 1 then
|
|
|
|
client_settings.linker.frameworks:add("CoreAudio")
|
|
|
|
client_settings.linker.frameworks:add("AudioToolbox")
|
|
|
|
client_settings.linker.frameworks:add("AudioUnit")
|
|
|
|
end
|
2008-10-21 15:59:32 +00:00
|
|
|
|
|
|
|
if use_sdl then
|
|
|
|
client_settings.linker.frameworks:add("SDL")
|
2008-10-21 16:16:16 +00:00
|
|
|
client_settings.cc.includes:add("/Library/Frameworks/SDL.framework/Headers")
|
2008-10-21 15:59:32 +00:00
|
|
|
end
|
2007-10-02 08:26:08 +00:00
|
|
|
else
|
2008-05-10 17:18:56 +00:00
|
|
|
if config.alsa.value == 1 then
|
|
|
|
client_settings.linker.libs:add("asound")
|
|
|
|
end
|
|
|
|
|
2007-10-02 08:26:08 +00:00
|
|
|
client_settings.linker.libs:add("X11")
|
|
|
|
client_settings.linker.libs:add("GL")
|
|
|
|
client_settings.linker.libs:add("GLU")
|
|
|
|
end
|
|
|
|
elseif family == "windows" then
|
2008-05-10 17:18:56 +00:00
|
|
|
client_settings.linker.libs:add("opengl32")
|
|
|
|
client_settings.linker.libs:add("glu32")
|
|
|
|
client_settings.linker.libs:add("winmm")
|
2007-10-02 08:26:08 +00:00
|
|
|
|
2008-05-10 17:18:56 +00:00
|
|
|
if config.dsound.value == 1 then
|
|
|
|
client_settings.linker.libs:add("dsound")
|
|
|
|
end
|
|
|
|
end
|
2008-10-21 16:31:19 +00:00
|
|
|
|
|
|
|
-- apply sdl settings
|
|
|
|
if use_sdl then config.sdl:apply(client_settings) end
|
2008-10-21 15:34:42 +00:00
|
|
|
|
2008-08-14 17:19:13 +00:00
|
|
|
engine = Compile(engine_settings, Collect("src/engine/*.c", "src/base/*.c"))
|
2007-10-02 08:26:08 +00:00
|
|
|
client = Compile(client_settings, Collect("src/engine/client/*.c"))
|
|
|
|
server = Compile(server_settings, Collect("src/engine/server/*.c"))
|
2007-08-22 07:52:33 +00:00
|
|
|
|
2008-09-03 18:09:06 +00:00
|
|
|
versionserver = Compile(settings, Collect("src/versionsrv/*.cpp"))
|
2007-07-21 18:07:27 +00:00
|
|
|
masterserver = Compile(settings, Collect("src/mastersrv/*.cpp"))
|
2008-06-12 10:51:48 +00:00
|
|
|
game_shared = Compile(settings, Collect("src/game/*.cpp"), nethash, network_source)
|
2008-08-27 15:51:09 +00:00
|
|
|
game_client = Compile(settings, Collect(
|
|
|
|
"src/game/client/*.cpp",
|
|
|
|
"src/game/client/components/*.cpp"), client_content_source)
|
2008-08-17 07:05:16 +00:00
|
|
|
game_server = Compile(settings, Collect(
|
|
|
|
"src/game/server/*.cpp",
|
|
|
|
"src/game/server/entities/*.cpp",
|
|
|
|
"src/game/server/gamemodes/*.cpp"), server_content_source)
|
2008-01-12 15:07:57 +00:00
|
|
|
game_editor = Compile(settings, Collect("src/game/editor/*.cpp"))
|
2007-07-21 18:07:27 +00:00
|
|
|
|
2007-09-23 18:27:04 +00:00
|
|
|
-- build tools (TODO: fix this so we don't get double _d_d stuff)
|
2007-07-24 22:53:43 +00:00
|
|
|
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
|
2008-10-08 16:33:08 +00:00
|
|
|
|
2008-10-21 15:59:32 +00:00
|
|
|
osxlaunch = {}
|
|
|
|
if platform == "macosx" and use_sdl then
|
|
|
|
osxlaunch = Compile(client_settings, Collect("src/osxlaunch/*.m"))
|
|
|
|
end
|
2007-07-24 22:53:43 +00:00
|
|
|
|
|
|
|
objs = Compile(settings, tools_src)
|
|
|
|
tools = {}
|
|
|
|
for i,v in objs do
|
2007-09-09 18:21:14 +00:00
|
|
|
toolname = PathFilename(PathBase(v))
|
2007-10-02 08:26:08 +00:00
|
|
|
tools[i] = Link(settings, toolname, v, engine, zlib)
|
2007-07-24 22:53:43 +00:00
|
|
|
end
|
|
|
|
|
2008-09-03 18:09:06 +00:00
|
|
|
-- build client, server, version server and master server
|
2008-03-22 18:40:27 +00:00
|
|
|
client_exe = Link(client_settings, "teeworlds", game_shared, game_client,
|
2008-01-12 15:07:57 +00:00
|
|
|
engine, client, game_editor, glfw, portaudio, zlib, pnglite, wavpack,
|
2008-10-21 15:59:32 +00:00
|
|
|
client_link_other, osxlaunch)
|
2007-10-02 08:26:08 +00:00
|
|
|
|
2008-03-22 18:40:27 +00:00
|
|
|
server_exe = Link(server_settings, "teeworlds_srv", engine, server,
|
2007-10-02 08:26:08 +00:00
|
|
|
game_shared, game_server, zlib)
|
2008-09-03 18:09:06 +00:00
|
|
|
|
|
|
|
versionserver_exe = Link(server_settings, "versionsrv", versionserver,
|
|
|
|
engine, zlib)
|
2007-10-02 08:26:08 +00:00
|
|
|
|
|
|
|
masterserver_exe = Link(server_settings, "mastersrv", masterserver,
|
|
|
|
engine, zlib)
|
2007-08-02 08:20:53 +00:00
|
|
|
|
|
|
|
-- make targets
|
|
|
|
c = PseudoTarget("client".."_"..settings.config_name, client_exe)
|
|
|
|
s = PseudoTarget("server".."_"..settings.config_name, server_exe)
|
2008-09-03 18:09:06 +00:00
|
|
|
v = PseudoTarget("versionserver".."_"..settings.config_name, versionserver_exe)
|
2007-08-02 08:20:53 +00:00
|
|
|
m = PseudoTarget("masterserver".."_"..settings.config_name, masterserver_exe)
|
|
|
|
t = PseudoTarget("tools".."_"..settings.config_name, tools)
|
2007-12-19 18:47:47 +00:00
|
|
|
|
2007-12-19 19:45:30 +00:00
|
|
|
Target(c)
|
|
|
|
Target(s)
|
2008-09-03 18:09:06 +00:00
|
|
|
Target(v)
|
2007-12-19 19:45:30 +00:00
|
|
|
Target(m)
|
|
|
|
Target(t)
|
|
|
|
|
2008-10-21 15:59:32 +00:00
|
|
|
all = PseudoTarget(settings.config_name, c, s, v, m, t)
|
2007-12-19 18:47:47 +00:00
|
|
|
|
2007-08-02 08:20:53 +00:00
|
|
|
Target(all)
|
|
|
|
return all
|
2007-07-21 18:07:27 +00:00
|
|
|
end
|
2007-05-22 15:05:28 +00:00
|
|
|
|
2007-08-02 08:20:53 +00:00
|
|
|
|
|
|
|
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)
|