waf: add option to override toolchain

This commit is contained in:
Francisco Ferreira 2019-02-21 14:33:37 +00:00 committed by Andrew Tridgell
parent b2523021fb
commit 03ed67a996
3 changed files with 8 additions and 3 deletions

View File

@ -35,7 +35,7 @@ class Board:
self.with_uavcan = False self.with_uavcan = False
def configure(self, cfg): def configure(self, cfg):
cfg.env.TOOLCHAIN = self.toolchain cfg.env.TOOLCHAIN = cfg.options.toolchain or self.toolchain
cfg.env.ROMFS_FILES = [] cfg.env.ROMFS_FILES = []
cfg.load('toolchain') cfg.load('toolchain')
cfg.load('cxx_checks') cfg.load('cxx_checks')

View File

@ -131,6 +131,8 @@ def configure(cfg):
_filter_supported_c_compilers('gcc', 'clang') _filter_supported_c_compilers('gcc', 'clang')
_filter_supported_cxx_compilers('g++', 'clang++') _filter_supported_cxx_compilers('g++', 'clang++')
cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
if cfg.env.TOOLCHAIN == 'native': if cfg.env.TOOLCHAIN == 'native':
cfg.load('compiler_cxx compiler_c') cfg.load('compiler_cxx compiler_c')
@ -139,8 +141,6 @@ def configure(cfg):
return return
cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
_set_pkgconfig_crosscompilation_wrapper(cfg) _set_pkgconfig_crosscompilation_wrapper(cfg)
cfg.find_program('%s-ar' % cfg.env.TOOLCHAIN, var='AR', quiet=True) cfg.find_program('%s-ar' % cfg.env.TOOLCHAIN, var='AR', quiet=True)
cfg.load('compiler_cxx compiler_c') cfg.load('compiler_cxx compiler_c')

View File

@ -75,6 +75,11 @@ def options(opt):
default=False, default=False,
help='Configure as debug variant.') 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', g.add_option('--disable-gccdeps',
action='store_true', action='store_true',
default=False, default=False,