waf: set variant of BuildContext classes in configure

Otherwise, a call like `waf configure --board <foo> <command1>` will make
`<command1>` run on wrong variant if there was a different variant configured
previously, or an empty variant if the project is "distcleaned".
This commit is contained in:
Gustavo Jose de Sousa 2016-07-29 11:24:59 -03:00 committed by Lucas De Marchi
parent 9749b91d46
commit f936291a52
1 changed files with 9 additions and 4 deletions

13
wscript
View File

@ -25,6 +25,12 @@ Configure.autoconfig = 'clobber'
# this makes recompilation at least when defines change. which might # this makes recompilation at least when defines change. which might
# be sufficient. # be sufficient.
def _set_build_context_variant(variant):
for c in Context.classes:
if not issubclass(c, Build.BuildContext):
continue
c.variant = variant
def init(ctx): def init(ctx):
env = ConfigSet.ConfigSet() env = ConfigSet.ConfigSet()
try: try:
@ -37,10 +43,7 @@ def init(ctx):
return return
# define the variant build commands according to the board # define the variant build commands according to the board
for c in Context.classes: _set_build_context_variant(env.VARIANT)
if not issubclass(c, Build.BuildContext):
continue
c.variant = env.VARIANT
def options(opt): def options(opt):
opt.load('compiler_cxx compiler_c waf_unit_test python') opt.load('compiler_cxx compiler_c waf_unit_test python')
@ -123,6 +126,8 @@ def configure(cfg):
cfg.env.VARIANT = cfg.env.BOARD cfg.env.VARIANT = cfg.env.BOARD
if cfg.env.DEBUG: if cfg.env.DEBUG:
cfg.env.VARIANT += '-debug' cfg.env.VARIANT += '-debug'
_set_build_context_variant(cfg.env.VARIANT)
cfg.setenv(cfg.env.VARIANT) cfg.setenv(cfg.env.VARIANT)
cfg.env.BOARD = cfg.options.board cfg.env.BOARD = cfg.options.board