Browse Source

waf: toolchain: add find_toolchain_program()

mission-4.1.18
Gustavo Jose de Sousa 9 years ago committed by Lucas De Marchi
parent
commit
80f03b618b
  1. 16
      Tools/ardupilotwaf/toolchain.py

16
Tools/ardupilotwaf/toolchain.py

@ -13,10 +13,12 @@ Example:: @@ -13,10 +13,12 @@ Example::
"""
from waflib import Errors, Context, Utils
from waflib.Configure import conf
from waflib.Tools import compiler_c, compiler_cxx
from waflib.Tools import clang, clangxx, gcc, gxx
import os
import re
def _set_toolchain_prefix_wrapper(tool_module, var, compiler_names):
original_configure = tool_module.configure
@ -116,6 +118,20 @@ def _filter_supported_cxx_compilers(*compilers): @@ -116,6 +118,20 @@ def _filter_supported_cxx_compilers(*compilers):
l = compiler_cxx.cxx_compiler[k]
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):
if cfg.env.TOOLCHAIN == 'native':
cfg.load('compiler_cxx compiler_c')

Loading…
Cancel
Save