Added an option to disable custom pool malloc...

...to scons and disabled it on windows.
This commit is contained in:
Sergey Popov 2008-12-03 13:30:30 +00:00
parent 9f12b5b1f1
commit ac816d4e38
3 changed files with 12 additions and 3 deletions

View file

@ -71,6 +71,7 @@ opts.AddOptions(
BoolOption('python', 'Enable in-game python extensions.', True),
BoolOption('raw_sockets', 'Set to use raw receiving sockets in the multiplayer network layer rather than the SDL_net facilities', False),
BoolOption('forum_user_handler', 'Enable forum user handler in wesnothd', False),
BoolOption('pool_alloc', 'Enable custom pool malloc', True),
('server_gid', 'group id of the user who runs wesnothd', ""),
('server_uid', 'user id of the user who runs wesnothd', ""),
EnumOption('gui', 'Set for GUI reductions for resolutions down to 320x240 (PDAs)', "normal", ["normal", "tiny"]),
@ -316,6 +317,9 @@ for env in [test_env, env]:
if not env["editor"]:
env.Append(CPPDEFINES = "DISABLE_EDITOR2")
if env["PLATFORM"] == "win32":
env["pool_alloc"] = False
if have_X:
env.Append(CPPDEFINES = "_X11")

View file

@ -19,8 +19,6 @@ libwesnoth_core_sources = Split("""
config.cpp
gettext.cpp
log.cpp
malloc.c
poolalloc.c
map.cpp
map_location.cpp
md5.cpp
@ -35,6 +33,11 @@ libwesnoth_core_sources = Split("""
serialization/string_utils.cpp
serialization/tokenizer.cpp
""")
if env["pool_alloc"]:
libwesnoth_core_sources.extend(Split("""
malloc.c
poolalloc.c
"""))
libwesnoth_core_sources.extend(env.Object("network_worker.cpp", EXTRA_DEFINE = env['raw_sockets'] and "NETWORK_USE_RAW_SOCKETS" or None))
@ -298,7 +301,7 @@ def WesnothProgram(env, target, source, can_build, **kw):
from SCons.Script.SConscript import SConsEnvironment
SConsEnvironment.WesnothProgram = WesnothProgram
game_cpp = python_env.Object("game.cpp");
game_cpp = python_env.Object("game.cpp", EXTRA_DEFINE = not env["pool_alloc"] and "DISABLE_POOL_ALLOC" or None);
env.WesnothProgram("wesnoth", [game_cpp] + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth, libcampaignd, env["wesnoth_res"]], have_client_prereqs)

View file

@ -2148,7 +2148,9 @@ void init_custom_malloc();
int main(int argc, char** argv)
{
#ifndef DISABLE_POOL_ALLOC
init_custom_malloc();
#endif
if(SDL_Init(SDL_INIT_TIMER) < 0) {
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
return(1);