Author: loonycyborg
Date: Mon Apr 27 13:00:14 2009
New Revision: 35253
URL: http://svn.gna.org/viewcvs/wesnoth?rev=35253&view=rev
Log:
Avoid linking programs against external dependencies they don't need.
Don't link wesnothd against pango etc, don't link the game against mysql..
Modified:
trunk/SConstruct
trunk/src/SConscript
Modified: trunk/SConstruct
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/SConstruct?rev=35253&r1=35252&r2=35253&view=diff
==============================================================================
--- trunk/SConstruct (original)
+++ trunk/SConstruct Mon Apr 27 13:00:14 2009
@@ -227,6 +227,9 @@
else:
return True
+ env = conf.Finish()
+ client_env = env.Clone()
+ conf = client_env.Configure(**configure_args)
have_client_prereqs = have_server_prereqs and \
conf.CheckPango("cairo") and \
conf.CheckPKG("fontconfig") and \
@@ -241,8 +244,8 @@
if env["PLATFORM"] != "win32":
have_X = conf.CheckLib('X11')
- if env['fribidi']:
- env['fribidi'] = conf.CheckLibWithHeader('fribidi',
'fribidi/fribidi.h', 'C', 'fribidi_utf8_to_unicode(NULL,0,NULL);') or
Warning("Can't find libfribidi, disabling freebidi support.")
+ if client_env['fribidi']:
+ client_env['fribidi'] = conf.CheckLibWithHeader('fribidi',
'fribidi/fribidi.h', 'C', 'fribidi_utf8_to_unicode(NULL,0,NULL);') or
Warning("Can't find libfribidi, disabling freebidi support.")
if env["PLATFORM"] == "posix":
conf.CheckCHeader("poll.h", "<>")
@@ -257,9 +260,9 @@
env.ParseConfig("mysql_config --libs --cflags")
env.Append(CPPDEFINES = ["HAVE_MYSQLPP"])
- env = conf.Finish()
-
- test_env = env.Clone()
+ client_env = conf.Finish()
+
+ test_env = client_env.Clone()
conf = test_env.Configure(**configure_args)
have_test_prereqs = have_client_prereqs and have_server_prereqs and
conf.CheckBoost('unit_test_framework', require_version = "1.33.0") or
Warning("Unit tests are disabled because their prerequisites are not met.")
@@ -283,6 +286,7 @@
have_server_prereqs = True
have_test_prereqs = True
test_env = env.Clone()
+ client_env = env.Clone()
have_msgfmt = env["MSGFMT"]
if not have_msgfmt:
@@ -299,11 +303,8 @@
# Implement configuration switches
#
-for env in [test_env, env]:
+for env in [test_env, client_env, env]:
env.Append(CPPPATH = ["#/", "#/src"])
-
- if "gnulink" in env["TOOLS"]:
- env.Append(LINKFLAGS = "-Wl,--as-needed")
env.Append(CPPDEFINES = ["HAVE_CONFIG_H"])
@@ -375,7 +376,7 @@
except:
env["svnrev"] = ""
-Export(Split("env test_env have_client_prereqs have_server_prereqs
have_test_prereqs"))
+Export(Split("env client_env test_env have_client_prereqs have_server_prereqs
have_test_prereqs"))
SConscript(dirs = Split("po doc packaging/windows"))
binaries = Split("wesnoth wesnothd cutter exploder campaignd test")
@@ -389,7 +390,7 @@
builds["glibcxx_debug"].update(builds["debug"])
build = env["build"]
-for env in [test_env, env]:
+for env in [test_env, client_env, env]:
env["extra_flags_glibcxx_debug"] = env["extra_flags_debug"]
env.AppendUnique(**builds[build])
env.Append(CXXFLAGS = os.environ.get('CXXFLAGS', []), LINKFLAGS =
os.environ.get('LDFLAGS', []))
Modified: trunk/src/SConscript
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=35253&r1=35252&r2=35253&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Mon Apr 27 13:00:14 2009
@@ -6,8 +6,8 @@
Import("*")
-env.Append(CPPDEFINES = "$EXTRA_DEFINE")
-test_env.Append(CPPDEFINES = "$EXTRA_DEFINE")
+for env in [test_env, client_env, env]:
+ env.Append(CPPDEFINES = "$EXTRA_DEFINE")
#color_range.cpp should be removed, but game_config depends on it.
#game_config has very few things that are needed elsewhere, it should be
@@ -114,10 +114,10 @@
wml_exception.cpp
""")
libwesnoth_sources.extend([
- env.Object("font.cpp", EXTRA_DEFINE = env['fribidi'] and "HAVE_FRIBIDI" or
None),
+ client_env.Object("font.cpp", EXTRA_DEFINE = env['fribidi'] and
"HAVE_FRIBIDI" or None),
])
-libwesnoth = env.Library("wesnoth", libwesnoth_sources)
+libwesnoth = client_env.Library("wesnoth", libwesnoth_sources)
libwesnothd_sources = Split("""
loadscreen_empty.cpp
@@ -128,18 +128,18 @@
libcampaignd_sources = Split("""
addon_checks.cpp
""")
-libcampaignd = env.Library("campaignd", libcampaignd_sources)
+libcampaignd = env.Library("campaignd", libcampaignd_sources, OBJPREFIX =
"campaignd_")
libwesnoth_sdl_sources = Split("""
sdl_utils.cpp
""")
-libwesnoth_sdl = env.Library("wesnoth_sdl", libwesnoth_sdl_sources)
+libwesnoth_sdl = client_env.Library("wesnoth_sdl", libwesnoth_sdl_sources)
libcutter_sources = Split("""
tools/exploder_utils.cpp
tools/exploder_cutter.cpp
""")
-libcutter = env.Library("cutter", libcutter_sources)
+libcutter = client_env.Library("cutter", libcutter_sources)
# Used by both 'wesnoth' and 'test' targets
wesnoth_sources = Split("""
@@ -161,6 +161,7 @@
attack_prediction_display.cpp
callable_objects.cpp
config_adapter.cpp
+ config_cache.cpp
controller_base.cpp
dialogs.cpp
floating_textbox.cpp
@@ -187,6 +188,7 @@
multiplayer_wait.cpp
multiplayer_create.cpp
multiplayer_lobby.cpp
+ multiplayer_connect.cpp
pathfind.cpp
playcampaign.cpp
play_controller.cpp
@@ -273,11 +275,7 @@
gui/widgets/window_builder.cpp
""")
-wesnoth_sources.extend(env.Object("game_preferences_display.cpp", EXTRA_DEFINE
= env["PLATFORM"] != "win32" and "WESNOTH_PREFIX='\"$prefix\"'" or None))
-wesnoth_sources.extend(env.Object(Split("""
- config_cache.cpp
- multiplayer_connect.cpp
- """)))
+wesnoth_sources.extend(client_env.Object("game_preferences_display.cpp",
EXTRA_DEFINE = env["PLATFORM"] != "win32" and "WESNOTH_PREFIX='\"$prefix\"'" or
None))
wesnoth_editor2_sources = Split("""
gui/dialogs/editor_generate_map.cpp
@@ -300,7 +298,7 @@
if env["editor"]:
wesnoth_sources += wesnoth_editor2_sources
-libwesnoth_extras = env.Library("wesnoth_extras", wesnoth_sources)
+libwesnoth_extras = client_env.Library("wesnoth_extras", wesnoth_sources)
#
# Target declarations
#
@@ -317,12 +315,12 @@
exec target + " = bin"
Export(target)
-env.AddMethod(WesnothProgram)
-test_env.AddMethod(WesnothProgram)
-
-game_cpp = 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)
+for env in [test_env, client_env, env]:
+ env.AddMethod(WesnothProgram)
+
+game_cpp = client_env.Object("game.cpp", EXTRA_DEFINE = not env["pool_alloc"]
and "DISABLE_POOL_ALLOC" or None);
+
+client_env.WesnothProgram("wesnoth", [game_cpp] + [libwesnoth_extras,
libwesnoth_core, libwesnoth_sdl, libwesnoth, libcampaignd, env["wesnoth_res"]],
have_client_prereqs)
campaignd_sources = Split("""
server/input_stream.cpp
@@ -332,8 +330,6 @@
campaignd_sources.extend(env.Object("campaign_server/campaign_server.cpp",
EXTRA_DEFINE = env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
env.WesnothProgram("campaignd", campaignd_sources + [libwesnoth_core,
libwesnothd, libcampaignd], have_server_prereqs)
-
-# I don't know Scons so I just add jwsmtp here...
wesnothd_sources = Split("""
server/ban.cpp
@@ -359,15 +355,13 @@
cutter_sources = Split("""
tools/cutter.cpp
""")
-env.WesnothProgram("cutter", cutter_sources + [libcutter, libwesnoth_core,
libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs,
- LIBS = env["LIBS"] + ["png"])
+client_env.WesnothProgram("cutter", cutter_sources + [libcutter,
libwesnoth_core, libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs,
LIBS = ["$LIBS", "png"])
exploder_sources = Split("""
tools/exploder.cpp
tools/exploder_composer.cpp
""")
-env.WesnothProgram("exploder", exploder_sources + [libcutter, libwesnoth_core,
libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs,
- LIBS = env["LIBS"] + ["png"])
+client_env.WesnothProgram("exploder", exploder_sources + [libcutter,
libwesnoth_core, libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs,
LIBS = ["$LIBS", "png"])
test_utils_sources = Split("""
tests/utils/game_config_manager.cpp
@@ -375,7 +369,7 @@
tests/utils/fake_display.cpp
""")
-libtest_utils = env.Library("test_utils", test_utils_sources)
+libtest_utils = test_env.Library("test_utils", test_utils_sources)
test_sources = Split("""
tests/main.cpp
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits