This commit is contained in:
Thomas Nagy 2012-01-05 22:34:29 +01:00
parent cdb339213b
commit 31c3ccda27
1 changed files with 30 additions and 9 deletions

View File

@ -11,12 +11,12 @@ out = 'build'
"""
Variant system for waf 1.6
call for example
Call for example:
$ waf configure build_debug build_release clean_debug clean_release
"""
def options(opt):
opt.load('compiler_c')
The builds will end in different build folders
note how "bld.variant" is used to detect the current variant
"""
def configure(conf):
@ -57,11 +57,8 @@ def build(bld):
# * add an 'env' parameter to a particular task generator:
# bld.program(..., env=bld.all_envs['release'].derive())
# ------ new declaration for variants -------
#
# calling 'waf clean_debug debug' will build into another output directory
# note how "bld.variant" is used to detect the current variant
#
def options(opt):
opt.load('compiler_c')
def init(ctx):
from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
@ -87,3 +84,27 @@ def init(ctx):
# the commands will be "build_win32/debug" or "build_win32/release"
# in this case you may want to modify Options.commands in this "init" function
# --------------------------
# or, if you want to memorize the default variant and just type "waf",
#
#def options(opt):
# opt.load('compiler_c')
#def init(ctx):
# from waflib import ConfigSet, Options
# env = ConfigSet.ConfigSet()
# try:
# env.load('build/c4che/foo.txt')
# except:
# the_variant = 'debug'
# else:
# the_variant = env.the_variant or debug
#
# if getattr(Options.options, 'the_variant', ''):
# if Options.options.the_variant != the_variant:
# the_variant = env.the_variant = Options.options.the_variant
# env.store('build/c4che/foo.txt')
#
# for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
# class tmp(y):
# variant = the_variant