SCons: replace deprecated Options() by new Variables() object

dop-in replacement, no functionality change. Requires SCons >= 1.0
This commit is contained in:
Fischlurch 2010-05-21 01:51:18 +02:00
parent d10380d124
commit 0977a7de6d

View file

@ -63,8 +63,8 @@ def setupBasicEnvironment():
Decider('MD5-timestamp') # detect changed files by timestamp, then do a MD5
opts = defineCmdlineOptions()
env = LumieraEnvironment(options=opts
vars = defineCmdlineVariables()
env = LumieraEnvironment(variables=vars
,toolpath = [TOOLDIR]
,tools = ["default", "BuilderGCH", "BuilderDoxygen"]
)
@ -101,8 +101,8 @@ def setupBasicEnvironment():
appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR/:.\\"'
,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera/:.\\"')
prepareOptionsHelp(opts,env)
opts.Save(OPTIONSCACHEFILE, env)
prepareOptionsHelp(vars,env)
vars.Save(OPTIONSCACHEFILE, env)
return env
def appendCppDefine(env,var,cppVar, elseVal=''):
@ -142,40 +142,40 @@ def handleVerboseMessages(env):
def defineCmdlineOptions():
""" current options will be persisted in a options cache file.
you may define custom options in a separate file.
def defineCmdlineVariables():
""" several toggles and configuration variables can be set on the commandline,
current settings will be persisted in a options cache file.
you may define custom variable settings in a separate file.
Commandline will override both.
"""
opts = Options([OPTIONSCACHEFILE, CUSTOPTIONSFILE])
opts.AddOptions(
vars = Variables([OPTIONSCACHEFILE, CUSTOPTIONSFILE])
vars.AddVariables(
('ARCHFLAGS', 'Set architecture-specific compilation flags (passed literally to gcc)','')
,('CC', 'Set the C compiler to use.', 'gcc')
,('CXX', 'Set the C++ compiler to use.', 'g++')
,PathOption('CCACHE', 'Integrate with CCache', '', PathOption.PathAccept)
,PathOption('DISTCC', 'Invoke C/C++ compiler commands through DistCC', '', PathOption.PathAccept)
,EnumOption('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA',
allowed_values=('ALPHA', 'BETA', 'RELEASE'))
,BoolOption('DEBUG', 'Build with debugging information and no optimisations', False)
,BoolOption('OPTIMIZE', 'Build with strong optimisation (-O3)', False)
,BoolOption('VALGRIND', 'Run Testsuite under valgrind control', True)
,BoolOption('VERBOSE', 'Print full build commands', False)
,PathVariable('CCACHE', 'Integrate with CCache', '', PathVariable.PathAccept)
,PathVariable('DISTCC', 'Invoke C/C++ compiler commands through DistCC', '', PathVariable.PathAccept)
,EnumVariable('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA', allowed_values=('ALPHA', 'BETA', 'RELEASE'))
,BoolVariable('DEBUG', 'Build with debugging information and no optimisations', False)
,BoolVariable('OPTIMIZE', 'Build with strong optimisation (-O3)', False)
,BoolVariable('VALGRIND', 'Run Testsuite under valgrind control', True)
,BoolVariable('VERBOSE', 'Print full build commands', False)
,('TESTSUITES', 'Run only Testsuites matching the given pattern', '')
# ,BoolOption('OPENGL', 'Include support for OpenGL preview rendering', False)
# ,EnumOption('DIST_TARGET', 'Build target architecture', 'auto',
# ,BoolVariable('OPENGL', 'Include support for OpenGL preview rendering', False)
# ,EnumVariable('DIST_TARGET', 'Build target architecture', 'auto',
# allowed_values=('auto', 'i386', 'i686', 'x86_64' ), ignorecase=2)
,PathOption('DESTDIR', 'Installation dir prefix', '/usr/local')
,PathOption('PKGLIBDIR', 'Installation dir for plugins, defaults to DESTDIR/lib/lumiera', '',PathOption.PathAccept)
,PathOption('PKGDATADIR', 'Installation dir for default config, usually DESTDIR/share/lumiera', '',PathOption.PathAccept)
,PathOption('SRCTAR', 'Create source tarball prior to compiling', '..', PathOption.PathAccept)
,PathOption('DOCTAR', 'Create tarball with developer documentation', '..', PathOption.PathAccept)
,PathVariable('DESTDIR', 'Installation dir prefix', '/usr/local')
,PathVariable('PKGLIBDIR', 'Installation dir for plugins, defaults to DESTDIR/lib/lumiera', '',PathVariable.PathAccept)
,PathVariable('PKGDATADIR', 'Installation dir for default config, usually DESTDIR/share/lumiera', '',PathVariable.PathAccept)
,PathVariable('SRCTAR', 'Create source tarball prior to compiling', '..', PathVariable.PathAccept)
,PathVariable('DOCTAR', 'Create tarball with developer documentation', '..', PathVariable.PathAccept)
)
return opts
return vars
def prepareOptionsHelp(opts,env):
def prepareOptionsHelp(vars,env):
prelude = """
USAGE: scons [-c] [OPTS] [key=val [key=val...]] [TARGETS]
Build and optionally install Lumiera.
@ -194,7 +194,7 @@ Special Targets:
Configuration Options:
"""
Help(prelude + opts.GenerateHelpText(env))
Help(prelude + vars.GenerateHelpText(env))