From f936291a5208f28926e9fb78d086460e07411656 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Fri, 29 Jul 2016 11:24:59 -0300 Subject: [PATCH] waf: set variant of BuildContext classes in configure Otherwise, a call like `waf configure --board ` will make `` run on wrong variant if there was a different variant configured previously, or an empty variant if the project is "distcleaned". --- wscript | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wscript b/wscript index e8e45dd3a3..a4dafb5b14 100644 --- a/wscript +++ b/wscript @@ -25,6 +25,12 @@ Configure.autoconfig = 'clobber' # this makes recompilation at least when defines change. which might # 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): env = ConfigSet.ConfigSet() try: @@ -37,10 +43,7 @@ def init(ctx): return # define the variant build commands according to the board - for c in Context.classes: - if not issubclass(c, Build.BuildContext): - continue - c.variant = env.VARIANT + _set_build_context_variant(env.VARIANT) def options(opt): opt.load('compiler_cxx compiler_c waf_unit_test python') @@ -123,6 +126,8 @@ def configure(cfg): cfg.env.VARIANT = cfg.env.BOARD if cfg.env.DEBUG: cfg.env.VARIANT += '-debug' + + _set_build_context_variant(cfg.env.VARIANT) cfg.setenv(cfg.env.VARIANT) cfg.env.BOARD = cfg.options.board