mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
waf: toolchain: add find_toolchain_program()
This commit is contained in:
parent
06a515645e
commit
80f03b618b
@ -13,10 +13,12 @@ Example::
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from waflib import Errors, Context, Utils
|
from waflib import Errors, Context, Utils
|
||||||
|
from waflib.Configure import conf
|
||||||
from waflib.Tools import compiler_c, compiler_cxx
|
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
|
||||||
|
import re
|
||||||
|
|
||||||
def _set_toolchain_prefix_wrapper(tool_module, var, compiler_names):
|
def _set_toolchain_prefix_wrapper(tool_module, var, compiler_names):
|
||||||
original_configure = tool_module.configure
|
original_configure = tool_module.configure
|
||||||
@ -116,6 +118,20 @@ def _filter_supported_cxx_compilers(*compilers):
|
|||||||
l = compiler_cxx.cxx_compiler[k]
|
l = compiler_cxx.cxx_compiler[k]
|
||||||
compiler_cxx.cxx_compiler[k] = [c for c in l if c in compilers]
|
compiler_cxx.cxx_compiler[k] = [c for c in l if c in compilers]
|
||||||
|
|
||||||
|
@conf
|
||||||
|
def find_toolchain_program(cfg, filename, **kw):
|
||||||
|
filename = Utils.to_list(filename)
|
||||||
|
|
||||||
|
if not kw.get('var', ''):
|
||||||
|
# just copy from the original implementation
|
||||||
|
kw['var'] = re.sub(r'[-.]', '_', filename[0].upper())
|
||||||
|
|
||||||
|
if cfg.env.TOOLCHAIN != 'native':
|
||||||
|
for i, name in enumerate(filename):
|
||||||
|
filename[i] = '%s-%s' % (cfg.env.TOOLCHAIN, name)
|
||||||
|
|
||||||
|
return cfg.find_program(filename, **kw)
|
||||||
|
|
||||||
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user