diff options
Diffstat (limited to 'mesonbuild/compilers')
| -rw-r--r-- | mesonbuild/compilers/asm.py | 29 | ||||
| -rw-r--r-- | mesonbuild/compilers/compilers.py | 1 | ||||
| -rw-r--r-- | mesonbuild/compilers/detect.py | 21 |
3 files changed, 51 insertions, 0 deletions
diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index 8cd5e28dc..d358ca992 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -7,6 +7,7 @@ from ..mesonlib import EnvironmentException, get_meson_command from ..options import OptionKey from .compilers import Compiler from .mixins.metrowerks import MetrowerksCompiler, mwasmarm_instruction_set_args, mwasmeppc_instruction_set_args +from .mixins.ti import TICompiler if T.TYPE_CHECKING: from ..environment import Environment @@ -259,6 +260,34 @@ class MasmARMCompiler(Compiler): return None +# https://downloads.ti.com/docs/esd/SPRUI04/ +class TILinearAsmCompiler(TICompiler, Compiler): + language = 'linearasm' + + def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, + for_machine: MachineChoice, info: MachineInfo, + linker: T.Optional[DynamicLinker] = None, + full_version: T.Optional[str] = None, is_cross: bool = False): + Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross) + TICompiler.__init__(self) + + def needs_static_linker(self) -> bool: + return True + + def get_always_args(self) -> T.List[str]: + return [] + + def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]: + return [] + + def sanity_check(self, work_dir: str, environment: Environment) -> None: + if self.info.cpu_family not in {'c6000'}: + raise EnvironmentException(f'TI Linear ASM compiler {self.id!r} does not support {self.info.cpu_family} CPU family') + + def get_depfile_suffix(self) -> str: + return 'd' + + class MetrowerksAsmCompiler(MetrowerksCompiler, Compiler): language = 'nasm' diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 3dfa0ff27..424bcc19b 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -69,6 +69,7 @@ lang_suffixes: T.Mapping[str, T.Tuple[str, ...]] = { 'cython': ('pyx', ), 'nasm': ('asm', 'nasm',), 'masm': ('masm',), + 'linearasm': ('sa',), } all_languages = lang_suffixes.keys() c_cpp_suffixes = {'h'} diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 5bc14350e..7bd48d10c 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -98,6 +98,7 @@ def compiler_from_language(env: 'Environment', lang: str, for_machine: MachineCh 'cython': detect_cython_compiler, 'nasm': detect_nasm_compiler, 'masm': detect_masm_compiler, + 'linearasm': detect_linearasm_compiler, } return lang_map[lang](env, for_machine) if lang in lang_map else None @@ -1376,6 +1377,26 @@ def detect_masm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp _handle_exceptions(popen_exceptions, [comp]) raise EnvironmentException('Unreachable code (exception to make mypy happy)') +def detect_linearasm_compiler(env: Environment, for_machine: MachineChoice) -> Compiler: + from .asm import TILinearAsmCompiler + comp = ['cl6x'] + comp_class: T.Type[Compiler] = TILinearAsmCompiler + arg = '-h' + info = env.machines[for_machine] + cc = detect_c_compiler(env, for_machine) + is_cross = env.is_cross_build(for_machine) + + popen_exceptions: T.Dict[str, Exception] = {} + try: + output = Popen_safe(comp + [arg])[2] + version = search_version(output) + env.coredata.add_lang_args(comp_class.language, comp_class, for_machine, env) + return comp_class([], comp, version, for_machine, info, cc.linker, is_cross=is_cross) + except OSError as e: + popen_exceptions[' '.join(comp + [arg])] = e + _handle_exceptions(popen_exceptions, [comp]) + raise EnvironmentException('Unreachable code (exception to make mypy happy)') + # GNU/Clang defines and version # ============================= |
