From 6e658452ec10083cb09e021e7528a71cc2e7b63b Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Wed, 23 Mar 2016 16:48:46 -0300 Subject: [PATCH] waf: toolchain: filter supported compilers for cross-compilation We currently only support GNU and clang compilers. --- Tools/ardupilotwaf/toolchain.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tools/ardupilotwaf/toolchain.py b/Tools/ardupilotwaf/toolchain.py index 9795158ef4..5eaa0b72b2 100644 --- a/Tools/ardupilotwaf/toolchain.py +++ b/Tools/ardupilotwaf/toolchain.py @@ -13,6 +13,7 @@ Example:: """ from waflib import Errors, Context, Utils +from waflib.Tools import compiler_c, compiler_cxx from waflib.Tools import clang, clangxx, gcc, gxx import os @@ -102,11 +103,24 @@ def _set_clang_crosscompilation_wrapper(tool_module): _set_clang_crosscompilation_wrapper(clang) _set_clang_crosscompilation_wrapper(clangxx) +def _filter_supported_c_compilers(*compilers): + for k in compiler_c.c_compiler: + l = compiler_c.c_compiler[k] + compiler_c.c_compiler[k] = [c for c in l if c in compilers] + +def _filter_supported_cxx_compilers(*compilers): + for k in compiler_cxx.cxx_compiler: + l = compiler_cxx.cxx_compiler[k] + compiler_cxx.cxx_compiler[k] = [c for c in l if c in compilers] + def configure(cfg): if cfg.env.TOOLCHAIN == 'native': cfg.load('compiler_cxx compiler_c') return + _filter_supported_c_compilers('gcc', 'clang') + _filter_supported_cxx_compilers('g++', 'clang++') + cfg.env.AR = cfg.env.TOOLCHAIN + '-ar' cfg.msg('Using toolchain', cfg.env.TOOLCHAIN) cfg.load('compiler_cxx compiler_c')