From 03ed67a99636d8504ad305a25120a2c16e1e622c Mon Sep 17 00:00:00 2001 From: Francisco Ferreira Date: Thu, 21 Feb 2019 14:33:37 +0000 Subject: [PATCH] waf: add option to override toolchain --- Tools/ardupilotwaf/boards.py | 2 +- Tools/ardupilotwaf/toolchain.py | 4 ++-- wscript | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index e30cce92fb..707263ce94 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -35,7 +35,7 @@ class Board: self.with_uavcan = False def configure(self, cfg): - cfg.env.TOOLCHAIN = self.toolchain + cfg.env.TOOLCHAIN = cfg.options.toolchain or self.toolchain cfg.env.ROMFS_FILES = [] cfg.load('toolchain') cfg.load('cxx_checks') diff --git a/Tools/ardupilotwaf/toolchain.py b/Tools/ardupilotwaf/toolchain.py index 2d79c6aa7d..596ab451c1 100644 --- a/Tools/ardupilotwaf/toolchain.py +++ b/Tools/ardupilotwaf/toolchain.py @@ -131,6 +131,8 @@ def configure(cfg): _filter_supported_c_compilers('gcc', 'clang') _filter_supported_cxx_compilers('g++', 'clang++') + cfg.msg('Using toolchain', cfg.env.TOOLCHAIN) + if cfg.env.TOOLCHAIN == 'native': cfg.load('compiler_cxx compiler_c') @@ -139,8 +141,6 @@ def configure(cfg): return - cfg.msg('Using toolchain', cfg.env.TOOLCHAIN) - _set_pkgconfig_crosscompilation_wrapper(cfg) cfg.find_program('%s-ar' % cfg.env.TOOLCHAIN, var='AR', quiet=True) cfg.load('compiler_cxx compiler_c') diff --git a/wscript b/wscript index 5deaf12d45..a01f21c1c4 100644 --- a/wscript +++ b/wscript @@ -75,6 +75,11 @@ def options(opt): default=False, help='Configure as debug variant.') + g.add_option('--toolchain', + action='store', + default=None, + help='Override default toolchain used for the board. Use "native" for using the host toolchain.') + g.add_option('--disable-gccdeps', action='store_true', default=False,