mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
waf: toolchain: filter supported compilers for cross-compilation
We currently only support GNU and clang compilers.
This commit is contained in:
parent
1b6a87d8b4
commit
6e658452ec
@ -13,6 +13,7 @@ Example::
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from waflib import Errors, Context, Utils
|
from waflib import Errors, Context, Utils
|
||||||
|
from waflib.Tools import compiler_c, compiler_cxx
|
||||||
from waflib.Tools import clang, clangxx, gcc, gxx
|
from waflib.Tools import clang, clangxx, gcc, gxx
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -102,11 +103,24 @@ def _set_clang_crosscompilation_wrapper(tool_module):
|
|||||||
_set_clang_crosscompilation_wrapper(clang)
|
_set_clang_crosscompilation_wrapper(clang)
|
||||||
_set_clang_crosscompilation_wrapper(clangxx)
|
_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):
|
def configure(cfg):
|
||||||
if cfg.env.TOOLCHAIN == 'native':
|
if cfg.env.TOOLCHAIN == 'native':
|
||||||
cfg.load('compiler_cxx compiler_c')
|
cfg.load('compiler_cxx compiler_c')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
_filter_supported_c_compilers('gcc', 'clang')
|
||||||
|
_filter_supported_cxx_compilers('g++', 'clang++')
|
||||||
|
|
||||||
cfg.env.AR = cfg.env.TOOLCHAIN + '-ar'
|
cfg.env.AR = cfg.env.TOOLCHAIN + '-ar'
|
||||||
cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
|
cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)
|
||||||
cfg.load('compiler_cxx compiler_c')
|
cfg.load('compiler_cxx compiler_c')
|
||||||
|
Loading…
Reference in New Issue
Block a user