mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 19:38:33 +00:00
357 lines
9.7 KiB
Python
357 lines
9.7 KiB
Python
# vi: syntax=python:et:ts=4
|
|
|
|
import commands, os
|
|
from subprocess import Popen, PIPE
|
|
from glob import glob
|
|
|
|
Import("*")
|
|
|
|
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
|
|
#removed. Requires moving path and version at least to other files.
|
|
|
|
libwesnoth_core_sources = Split("""
|
|
color_range.cpp
|
|
config.cpp
|
|
gettext.cpp
|
|
log.cpp
|
|
map.cpp
|
|
network.cpp
|
|
thread.cpp
|
|
tstring.cpp
|
|
util.cpp
|
|
serialization/binary_or_text.cpp
|
|
serialization/binary_wml.cpp
|
|
serialization/parser.cpp
|
|
serialization/preprocessor.cpp
|
|
serialization/string_utils.cpp
|
|
serialization/tokenizer.cpp
|
|
""")
|
|
|
|
libwesnoth_core_sources.extend(env.Object("network_worker.cpp", EXTRA_DEFINE = env['raw_sockets'] and "NETWORK_USE_RAW_SOCKETS" or None))
|
|
|
|
game_config_env = env.Clone()
|
|
filesystem_env = env.Clone()
|
|
if env["PLATFORM"] != "win32":
|
|
game_config_env.Append(CPPDEFINES = "WESNOTH_PATH='\"$datadir\"'")
|
|
if env['localedirname']:
|
|
filesystem_env.Append(CPPDEFINES = "LOCALEDIR='\"$localedirname\"'")
|
|
if not os.path.isabs(env['localedirname']):
|
|
filesystem_env.Append(CPPDEFINES = "HAS_RELATIVE_LOCALEDIR")
|
|
if env['prefsdir']:
|
|
filesystem_env.Append(CPPDEFINES = "PREFERENCES_DIR='\"$prefsdir\"'")
|
|
|
|
libwesnoth_core_sources.extend([
|
|
game_config_env.Object("game_config.cpp"),
|
|
filesystem_env.Object("filesystem.cpp")
|
|
])
|
|
|
|
libwesnoth_core = env.Library("wesnoth_core", libwesnoth_core_sources)
|
|
|
|
libwesnoth_sources = Split("""
|
|
astarnode.cpp
|
|
astarsearch.cpp
|
|
builder.cpp
|
|
cavegen.cpp
|
|
clipboard.cpp
|
|
construct_dialog.cpp
|
|
cursor.cpp
|
|
display.cpp
|
|
events.cpp
|
|
filechooser.cpp
|
|
generic_event.cpp
|
|
hotkeys.cpp
|
|
image.cpp
|
|
key.cpp
|
|
loadscreen.cpp
|
|
map_create.cpp
|
|
map_label.cpp
|
|
mapgen.cpp
|
|
mapgen_dialog.cpp
|
|
marked-up_text.cpp
|
|
minimap.cpp
|
|
pathutils.cpp
|
|
preferences.cpp
|
|
preferences_display.cpp
|
|
race.cpp
|
|
random.cpp
|
|
reports.cpp
|
|
show_dialog.cpp
|
|
sound.cpp
|
|
soundsource.cpp
|
|
terrain.cpp
|
|
terrain_translation.cpp
|
|
text.cpp
|
|
time_of_day.cpp
|
|
tooltips.cpp
|
|
video.cpp
|
|
theme.cpp
|
|
widgets/button.cpp
|
|
widgets/file_menu.cpp
|
|
widgets/label.cpp
|
|
widgets/menu.cpp
|
|
widgets/menu_style.cpp
|
|
widgets/progressbar.cpp
|
|
widgets/scrollarea.cpp
|
|
widgets/scrollbar.cpp
|
|
widgets/slider.cpp
|
|
widgets/textbox.cpp
|
|
widgets/widget.cpp
|
|
wml_exception.cpp
|
|
""")
|
|
libwesnoth_sources.extend([
|
|
env.Object("font.cpp", EXTRA_DEFINE = env['fribidi'] and "HAVE_FRIBIDI" or None),
|
|
env.Object("language.cpp", EXTRA_DEFINE = env['dummy_locales'] and "USE_DUMMYLOCALES" or None)
|
|
])
|
|
|
|
libwesnoth = env.Library("wesnoth", libwesnoth_sources)
|
|
|
|
libwesnothd_sources = Split("""
|
|
loadscreen_empty.cpp
|
|
tools/dummy_video.cpp
|
|
""")
|
|
libwesnothd = env.Library("wesnothd", libwesnothd_sources)
|
|
|
|
libcampaignd_sources = Split("""
|
|
addon_checks.cpp
|
|
""")
|
|
libcampaignd = env.Library("campaignd", libcampaignd_sources)
|
|
|
|
libwesnoth_sdl_sources = Split("""
|
|
sdl_utils.cpp
|
|
""")
|
|
libwesnoth_sdl = env.Library("wesnoth_sdl", libwesnoth_sdl_sources)
|
|
|
|
libcutter_sources = Split("""
|
|
tools/exploder_utils.cpp
|
|
tools/exploder_cutter.cpp
|
|
""")
|
|
libcutter = env.Library("cutter", libcutter_sources)
|
|
|
|
# Used by both 'wesnoth' and 'test' targets
|
|
wesnoth_sources = Split("""
|
|
about.cpp
|
|
actions.cpp
|
|
addon_checks.cpp
|
|
addon_management.cpp
|
|
ai_dfool.cpp
|
|
ai_attack.cpp
|
|
ai_move.cpp
|
|
ai_village.cpp
|
|
animated_game.cpp
|
|
attack_prediction.cpp
|
|
attack_prediction_display.cpp
|
|
callable_objects.cpp
|
|
config_adapter.cpp
|
|
controller_base.cpp
|
|
dialogs.cpp
|
|
floating_textbox.cpp
|
|
formula.cpp
|
|
formula_ai.cpp
|
|
formula_function.cpp
|
|
formula_tokenizer.cpp
|
|
game_display.cpp
|
|
game_events.cpp
|
|
game_preferences.cpp
|
|
gamestatus.cpp
|
|
generate_report.cpp
|
|
halo.cpp
|
|
help.cpp
|
|
intro.cpp
|
|
leader_list.cpp
|
|
menu_events.cpp
|
|
mouse_events.cpp
|
|
mouse_handler_base.cpp
|
|
multiplayer.cpp
|
|
multiplayer_ui.cpp
|
|
multiplayer_wait.cpp
|
|
multiplayer_create.cpp
|
|
multiplayer_lobby.cpp
|
|
pathfind.cpp
|
|
playcampaign.cpp
|
|
play_controller.cpp
|
|
playmp_controller.cpp
|
|
playsingle_controller.cpp
|
|
playturn.cpp
|
|
replay.cpp
|
|
replay_controller.cpp
|
|
sha1.cpp
|
|
settings.cpp
|
|
statistics.cpp
|
|
statistics_dialog.cpp
|
|
team.cpp
|
|
terrain_filter.cpp
|
|
time_of_day.cpp
|
|
titlescreen.cpp
|
|
unit.cpp
|
|
unit_abilities.cpp
|
|
unit_animation.cpp
|
|
unit_display.cpp
|
|
unit_frame.cpp
|
|
unit_map.cpp
|
|
unit_types.cpp
|
|
upload_log.cpp
|
|
variable.cpp
|
|
variant.cpp
|
|
widgets/combo.cpp
|
|
widgets/scrollpane.cpp
|
|
gui/dialogs/addon_connect.cpp
|
|
gui/dialogs/dialog.cpp
|
|
gui/dialogs/language_selection.cpp
|
|
gui/dialogs/mp_connect.cpp
|
|
gui/dialogs/mp_method_selection.cpp
|
|
gui/widgets/button.cpp
|
|
gui/widgets/canvas.cpp
|
|
gui/widgets/control.cpp
|
|
gui/widgets/container.cpp
|
|
gui/widgets/event_handler.cpp
|
|
gui/widgets/grid.cpp
|
|
gui/widgets/helper.cpp
|
|
gui/widgets/label.cpp
|
|
gui/widgets/listbox.cpp
|
|
gui/widgets/panel.cpp
|
|
gui/widgets/settings.cpp
|
|
gui/widgets/scrollbar.cpp
|
|
gui/widgets/spacer.cpp
|
|
gui/widgets/text.cpp
|
|
gui/widgets/text_box.cpp
|
|
gui/widgets/toggle_button.cpp
|
|
gui/widgets/toggle_panel.cpp
|
|
gui/widgets/tooltip.cpp
|
|
gui/widgets/vertical_scrollbar.cpp
|
|
gui/widgets/widget.cpp
|
|
gui/widgets/window.cpp
|
|
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))
|
|
python_env = env.Clone()
|
|
if env['python']:
|
|
python_env.Append(CPPDEFINES = "HAVE_PYTHON")
|
|
wesnoth_sources.extend(python_env.Object(Split("""
|
|
ai_python.cpp
|
|
ai.cpp
|
|
multiplayer_connect.cpp
|
|
""")))
|
|
|
|
# used with editor2 option in the wesnoth target
|
|
wesnoth_editor2_sources = Split("""
|
|
editor2/action.cpp
|
|
editor2/editor_main.cpp
|
|
editor2/editor_controller.cpp
|
|
editor2/editor_display.cpp
|
|
editor2/editor_map.cpp
|
|
editor2/editor_mode.cpp
|
|
editor2/editor_mouse_handler.cpp
|
|
editor2/mouse_action.cpp
|
|
""")
|
|
|
|
if env['editor2']:
|
|
wesnoth_sources += wesnoth_editor2_sources
|
|
|
|
libwesnoth_extras = env.Library("wesnoth_extras", wesnoth_sources)
|
|
#
|
|
# Target declarations
|
|
#
|
|
|
|
def WesnothProgram(env, target, source, can_build, **kw):
|
|
if can_build:
|
|
bin = env.Program(target, source, **kw)
|
|
else:
|
|
bin = None
|
|
exec target + " = bin"
|
|
Export(target)
|
|
|
|
from SCons.Script.SConscript import SConsEnvironment
|
|
SConsEnvironment.WesnothProgram = WesnothProgram
|
|
|
|
game_cpp = python_env.Object("game.cpp");
|
|
|
|
env.WesnothProgram("wesnoth", [game_cpp] + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth, libcampaignd] + wesnoth_res, have_client_prereqs)
|
|
|
|
wesnoth_editor_sources = Split("""
|
|
editor/editor.cpp
|
|
editor/editor_layout.cpp
|
|
editor/map_manip.cpp
|
|
editor/editor_display.cpp
|
|
editor/editor_palettes.cpp
|
|
editor/editor_main.cpp
|
|
editor/editor_dialogs.cpp
|
|
editor/editor_undo.cpp
|
|
animated_editor.cpp
|
|
""")
|
|
env.WesnothProgram("wesnoth_editor", wesnoth_editor_sources + [libwesnoth_core, libwesnoth_sdl, libwesnoth] + wesnoth_editor_res, have_client_prereqs and not env["editor2"])
|
|
|
|
campaignd_sources = Split("""
|
|
server/input_stream.cpp
|
|
""")
|
|
|
|
if env["PLATFORM"] == "win32": env["fifodir"] = ""
|
|
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)
|
|
|
|
wesnothd_sources = Split("""
|
|
server/ban.cpp
|
|
server/game.cpp
|
|
server/input_stream.cpp
|
|
server/metrics.cpp
|
|
server/player.cpp
|
|
server/proxy.cpp
|
|
server/simple_wml.cpp
|
|
time.cpp
|
|
""")
|
|
wesnothd_sources.extend(env.Object("server/server.cpp", EXTRA_DEFINE = env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
|
|
|
|
env.WesnothProgram("wesnothd", wesnothd_sources + [libwesnoth_core, libwesnothd], have_server_prereqs)
|
|
|
|
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"])
|
|
|
|
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"])
|
|
|
|
test_utils_sources = Split("""
|
|
tests/utils/fake_event_source.cpp
|
|
tests/utils/fake_display.cpp
|
|
""")
|
|
|
|
libtest_utils = env.Library("test_utils", test_utils_sources)
|
|
|
|
test_sources = Split("""
|
|
tests/main.cpp
|
|
tests/test_util.cpp
|
|
tests/test_network_worker.cpp
|
|
tests/test_save_dialog.cpp
|
|
""")
|
|
test = test_env.WesnothProgram("test", test_sources + [libwesnoth_extras, libwesnoth_core, libwesnoth_sdl, libwesnoth,libtest_utils], have_test_prereqs)
|
|
#Export("test")
|
|
|
|
if env["svnrev"] != "" and env["svnrev"] != "exported":
|
|
revision_define = "#define REVISION \"%s\"\n" % env["svnrev"]
|
|
env.Command("revision.hpp", Value(env["svnrev"]), Action(
|
|
lambda target, source, env: open(str(target[0]), "w").write(revision_define),
|
|
"Generating revision.hpp..."
|
|
))
|
|
game_config_env.Append(CPPDEFINES = 'HAVE_REVISION')
|
|
|
|
sources = []
|
|
if "TAGS" in COMMAND_LINE_TARGETS:
|
|
EnsureSConsVersion(0, 98)
|
|
sources = [ Glob(os.path.join(dir, pattern)) for dir in ["", "*", "*/*"] for pattern in ["*.cpp", "*.hpp"] ]
|
|
|
|
Export("sources")
|
|
|
|
# Local variables:
|
|
# mode: python
|
|
# end:
|