Add experimental option.
This defaults to 'yes' for odd-numbered (unstable) versions, 'no' for even-numbered (unstable) versions. It controls an EXPERIMENTAL preprocessor symbol, defined only when experimental is 'yes', and an EXPERIMENTAL automake conditional. This is meant as a guard option for experimental, developer-only code that should be disabled in stable versions. The immediate application is fendrin's new pathfinding/tunnel code, which we want to carry in the main codebase for the remainder of 1.7 but be automatically disabled in 1.8 betas and 1.8 itself. Implemented for scons and autotools but not yet cmake.
This commit is contained in:
parent
cd1859b299
commit
30d0e3935b
2 changed files with 37 additions and 2 deletions
22
SConstruct
22
SConstruct
|
@ -22,10 +22,26 @@ if os.path.exists('.scons-option-cache'):
|
|||
print "Saved options:", optfile.read().replace("\n", ", ")[:-2]
|
||||
optfile.close()
|
||||
|
||||
#
|
||||
# Get the Wesnoth version number
|
||||
#
|
||||
|
||||
config_h_re = re.compile(r"^.*#define\s*(\S*)\s*\"(\S*)\".*$", re.MULTILINE)
|
||||
build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents()) )
|
||||
try:
|
||||
version = build_config["VERSION"]
|
||||
print "Building Wesnoth version %s" % version
|
||||
except KeyError:
|
||||
print "Couldn't determin the Wesnoth version number, bailing out!"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Build-control options
|
||||
#
|
||||
|
||||
# Experimental code is enabled by default in unstable (odd minor version).
|
||||
experimental_default = (int(version.split(".")[1]) % 2) == 1
|
||||
|
||||
opts = Variables('.scons-option-cache')
|
||||
|
||||
def OptionalPath(key, val, env):
|
||||
|
@ -59,6 +75,7 @@ opts.AddVariables(
|
|||
PathVariable('python_site_packages_dir', 'sets the directory where python modules are installed', "lib/python/site-packages/wesnoth", PathVariable.PathAccept),
|
||||
BoolVariable('editor', 'Enable editor', True),
|
||||
BoolVariable('lowmem', 'Set to reduce memory usage by removing extra functionality', False),
|
||||
BoolVariable('experimental', 'Enable experimental code for developees only', experimental_default),
|
||||
BoolVariable('lua', 'Enable Lua support', True),
|
||||
BoolVariable('notifications', 'Enable support for desktop notifications', True),
|
||||
BoolVariable('nls','enable compile/install of gettext message catalogs',True),
|
||||
|
@ -380,6 +397,9 @@ for env in [test_env, client_env, env]:
|
|||
if env['lowmem']:
|
||||
env.Append(CPPDEFINES = "LOW_MEM")
|
||||
|
||||
if env['experimental']:
|
||||
env.Append(CPPDEFINES = "EXPERIMENTAL")
|
||||
|
||||
if env['internal_data']:
|
||||
env.Append(CPPDEFINES = "USE_INTERNAL_DATA")
|
||||
|
||||
|
@ -573,8 +593,6 @@ env.Precious(uninstall)
|
|||
#
|
||||
# Making a distribution tarball.
|
||||
#
|
||||
config_h_re = re.compile(r"^.*#define\s*(\S*)\s*\"(\S*)\".*$", re.MULTILINE)
|
||||
build_config = dict( config_h_re.findall(File("src/wesconfig.h").get_contents()) )
|
||||
env["version"] = build_config.get("VERSION")
|
||||
if 'dist' in COMMAND_LINE_TARGETS: # Speedup, the manifest is expensive
|
||||
def dist_manifest():
|
||||
|
|
17
configure.ac
17
configure.ac
|
@ -6,7 +6,12 @@
|
|||
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
#######################################################################
|
||||
# Don't forget to change the default value of 'experimental'
|
||||
# to match whether this is a stable or unstable release.
|
||||
#######################################################################
|
||||
define([WESNOTH_VERSION],[1.7.12+svn])
|
||||
experimental_default=yes
|
||||
define([WESNOTH_BUGS],[http://bugs.wesnoth.org])
|
||||
|
||||
AC_INIT([Battle for Wesnoth], WESNOTH_VERSION, WESNOTH_BUGS, [wesnoth])
|
||||
|
@ -168,6 +173,18 @@ then
|
|||
CPPFLAGS="$CPPFLAGS -DDEBUG_WINDOW_LAYOUT_GRAPHS"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([experimental],
|
||||
AS_HELP_STRING([--enable-experimental], [enable experimental developer-only code]),
|
||||
[experimental=$enableval],
|
||||
[experimental=$experimental_default])
|
||||
|
||||
if test "x$experimental" = "xyes"
|
||||
then
|
||||
CPPFLAGS="$CPPFLAGS -DUSE_TINY_GUI"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([EXPERIMENTAL], [test "x$experimental" = "xyes"])
|
||||
|
||||
DATADIR=$PACKAGE
|
||||
AC_ARG_WITH([datadir-name],
|
||||
AS_HELP_STRING([--with-datadir-name@<:@=DIR@:>@], [change name of data directory @<:@wesnoth@:>@]),
|
||||
|
|
Loading…
Add table
Reference in a new issue