From 95aeb0346e94a1cbe4fd0d6dab7d822ace6c8f27 Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Mon, 21 Mar 2016 20:55:23 -0300 Subject: [PATCH] waf: load compilers tools in toolchain tool It makes more sense the toolchain Waf tool to be responsible of loading the compilers. Furthermore, that allows toolchain tool to have control on doing configuration before and after loading compiler tools. --- Tools/ardupilotwaf/boards.py | 1 - Tools/ardupilotwaf/toolchain.py | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 550278f615..ac29bb84bc 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -31,7 +31,6 @@ class Board: def configure(self, cfg): cfg.env.TOOLCHAIN = self.toolchain cfg.load('toolchain') - cfg.load('compiler_cxx compiler_c') env = waflib.ConfigSet.ConfigSet() self.configure_env(cfg, env) diff --git a/Tools/ardupilotwaf/toolchain.py b/Tools/ardupilotwaf/toolchain.py index 2ac66c8fb1..c1ab19c7a4 100644 --- a/Tools/ardupilotwaf/toolchain.py +++ b/Tools/ardupilotwaf/toolchain.py @@ -1,15 +1,15 @@ """ WAF Tool to select the correct toolchain based on the target archtecture. -This tool must be loaded before compiler tools. Use the environment variable -TOOLCHAIN to define the toolchain prefix. +This tool loads compiler_c and compiler_cxx, so you don't need to load them +(and you must not load them before this tool). Use the environment variable +TOOLCHAIN to define the toolchain. Example:: def configure(cfg): cfg.env.TOOLCHAIN = 'arm-linux-gnueabihf' cfg.load('toolchain') - cfg.load('cxx_compiler') """ from waflib import Utils, Context @@ -44,6 +44,7 @@ def configure(cfg): toolchain = cfg.env.TOOLCHAIN if toolchain == 'native': + cfg.load('compiler_cxx compiler_c') return cfg.msg('Using toolchain', toolchain) @@ -84,3 +85,5 @@ def configure(cfg): elif 'clang++' == cxx_compiler: cfg.env['CXX'] = 'clang++' cfg.env.CXXFLAGS += clang_flags + + cfg.load('compiler_cxx compiler_c')