summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/detect.py
diff options
context:
space:
mode:
authorWu, Zhenyu <wuzhenyu@ustc.edu>2024-12-09 21:41:29 +0800
committerJussi Pakkanen <jpakkane@gmail.com>2025-01-09 14:52:09 +0200
commit910db36e3851f384b4aa2bfb834af92f88b61d77 (patch)
tree08cb6c3518ace0e790b9991ee05e9a16e1721256 /mesonbuild/compilers/detect.py
parent5713f6a7ef2eda8606dd488985b4f74678815cca (diff)
downloadmeson-910db36e3851f384b4aa2bfb834af92f88b61d77.tar.gz
Add Linear ASM compiler
Fix #13670
Diffstat (limited to 'mesonbuild/compilers/detect.py')
-rw-r--r--mesonbuild/compilers/detect.py21
1 files changed, 21 insertions, 0 deletions
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
# =============================