Added support for autorevision to scons

This commit is contained in:
Sergey Popov 2013-03-17 00:38:13 +00:00
parent 45a073d033
commit 0a2fa1575a
2 changed files with 7 additions and 3 deletions

View File

@ -443,7 +443,7 @@ for env in [test_env, client_env, env]:
if not env['static_test']:
test_env.Append(CPPDEFINES = "BOOST_TEST_DYN_LINK")
if os.path.exists('.git'):
if os.path.exists('.git') and (file(".git/config").read().find("svn-remote") != -1):
try:
env["svnrev"] = Popen(Split("git svn find-rev refs/remotes/trunk"), stdout=PIPE, stderr=PIPE).communicate()[0].rstrip("\n")
if not env["svnrev"]:
@ -457,10 +457,12 @@ if os.path.exists('.git'):
except:
env["svnrev"] = ""
else:
env["svnrev"] = ""
try:
env["svnrev"] = Popen(Split("svnversion -n ."), stdout=PIPE).communicate()[0]
if call("utils/autorevision -t h > revision.h", shell=True) == 0:
env["have_autorevision"] = True
except:
env["svnrev"] = ""
pass
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))

View File

@ -647,6 +647,8 @@ if env["svnrev"] != "" and env["svnrev"] != "exported":
"Generating revision.hpp..."
))
game_config_env.Append(CPPDEFINES = 'HAVE_REVISION')
if env.get("have_autorevision"):
game_config_env.Append(CPPDEFINES = 'LOAD_REVISION')
sources = []
if "TAGS" in COMMAND_LINE_TARGETS: