Refactored alias and hardlink related code in scons script.
This commit is contained in:
parent
e4a98b833b
commit
8b96d4f06d
2 changed files with 7 additions and 6 deletions
|
@ -348,14 +348,12 @@ if build == "base":
|
|||
else:
|
||||
build_dir = os.path.join("build", build)
|
||||
|
||||
if build == "release" : build_suffix = "" + env["PROGSUFFIX"]
|
||||
else : build_suffix = "-" + build + env["PROGSUFFIX"]
|
||||
Export("build_suffix")
|
||||
SConscript("src/SConscript", build_dir = build_dir, exports = "env")
|
||||
Import(binaries + ["sources"])
|
||||
binary_nodes = map(eval, binaries)
|
||||
if build == "release" : build_suffix = "" + env["PROGSUFFIX"]
|
||||
else : build_suffix = "-" + build + env["PROGSUFFIX"]
|
||||
from install import HardLink
|
||||
wc_binaries = [ bin and env.Command(bin[0].name.split(".")[0] + build_suffix, bin, HardLink("$TARGET", "$SOURCE")) or None for bin in binary_nodes ]
|
||||
map(lambda bin, node, wc_bin: Alias(bin, [node, wc_bin]), binaries, binary_nodes, wc_binaries)
|
||||
all = env.Alias("all", map(Alias, binaries))
|
||||
env.Default(map(Alias, env["default_targets"]))
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import commands, os
|
||||
from subprocess import Popen, PIPE
|
||||
from glob import glob
|
||||
from install import HardLink
|
||||
|
||||
Import("*")
|
||||
|
||||
|
@ -281,8 +282,11 @@ libwesnoth_extras = env.Library("wesnoth_extras", wesnoth_sources)
|
|||
def WesnothProgram(env, target, source, can_build, **kw):
|
||||
if can_build:
|
||||
bin = env.Program(target, source, **kw)
|
||||
link = env.Command("#/" + target + build_suffix, bin, HardLink("$TARGET", "$SOURCE"))
|
||||
else:
|
||||
bin = None
|
||||
link = None
|
||||
env.Alias(target, link)
|
||||
exec target + " = bin"
|
||||
Export(target)
|
||||
|
||||
|
@ -371,7 +375,6 @@ test_sources = Split("""
|
|||
test_sources.extend(test_env.Object("tests/test_config_cache.cpp", EXTRA_DEFINE = env['python'] and "HAVE_PYTHON" or None))
|
||||
|
||||
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"]
|
||||
|
|
Loading…
Add table
Reference in a new issue