diff options
author | Nomura <nomura.rh@gmail.com> | 2023-03-28 11:25:19 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-04-24 09:07:37 -0400 |
commit | 18cfa545f03ddb6cb8378fdadec4f284aa7ea221 (patch) | |
tree | d75c230d056ad9224087380d213e54a5ace40f87 /mesonbuild/linkers | |
parent | bda799dff2dc4b5d607f0e822b12ed0e2db38fb7 (diff) | |
download | meson-18cfa545f03ddb6cb8378fdadec4f284aa7ea221.zip meson-18cfa545f03ddb6cb8378fdadec4f284aa7ea221.tar.gz meson-18cfa545f03ddb6cb8378fdadec4f284aa7ea221.tar.bz2 |
Initial support for Metrowerks C/C++ compiler
Diffstat (limited to 'mesonbuild/linkers')
-rw-r--r-- | mesonbuild/linkers/__init__.py | 12 | ||||
-rw-r--r-- | mesonbuild/linkers/linkers.py | 65 |
2 files changed, 77 insertions, 0 deletions
diff --git a/mesonbuild/linkers/__init__.py b/mesonbuild/linkers/__init__.py index 298e901..ff50d69 100644 --- a/mesonbuild/linkers/__init__.py +++ b/mesonbuild/linkers/__init__.py @@ -36,6 +36,9 @@ from .linkers import ( AIXArLinker, PGIStaticLinker, NvidiaHPC_StaticLinker, + MetrowerksStaticLinker, + MetrowerksStaticLinkerARM, + MetrowerksStaticLinkerEmbeddedPowerPC, DynamicLinker, PosixDynamicLinkerMixin, @@ -58,6 +61,9 @@ from .linkers import ( PGIDynamicLinker, NvidiaHPC_DynamicLinker, NAGDynamicLinker, + MetrowerksLinker, + MetrowerksLinkerARM, + MetrowerksLinkerEmbeddedPowerPC, VisualStudioLikeLinkerMixin, MSVCDynamicLinker, @@ -98,6 +104,9 @@ __all__ = [ 'AppleArLinker', 'PGIStaticLinker', 'NvidiaHPC_StaticLinker', + 'MetrowerksStaticLinker', + 'MetrowerksStaticLinkerARM', + 'MetrowerksStaticLinkerEmbeddedPowerPC', 'DynamicLinker', 'PosixDynamicLinkerMixin', @@ -120,6 +129,9 @@ __all__ = [ 'PGIDynamicLinker', 'NvidiaHPC_DynamicLinker', 'NAGDynamicLinker', + 'MetrowerksLinker', + 'MetrowerksLinkerARM', + 'MetrowerksLinkerEmbeddedPowerPC', 'VisualStudioLikeLinkerMixin', 'MSVCDynamicLinker', diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py index 4c00032..2db82e3 100644 --- a/mesonbuild/linkers/linkers.py +++ b/mesonbuild/linkers/linkers.py @@ -327,6 +327,28 @@ class AIXArLinker(ArLikeLinker): std_args = ['-csr', '-Xany'] +class MetrowerksStaticLinker(StaticLinker): + + def can_linker_accept_rsp(self) -> bool: + return True + + def get_linker_always_args(self) -> T.List[str]: + return ['-library'] + + def get_output_args(self, target: str) -> T.List[str]: + return ['-o', target] + + def rsp_file_syntax(self) -> RSPFileSyntax: + return RSPFileSyntax.GCC + + +class MetrowerksStaticLinkerARM(MetrowerksStaticLinker): + id = 'mwldarm' + + +class MetrowerksStaticLinkerEmbeddedPowerPC(MetrowerksStaticLinker): + id = 'mwldeppc' + def prepare_rpaths(raw_rpaths: T.Tuple[str, ...], build_dir: str, from_dir: str) -> T.List[str]: # The rpaths we write must be relative if they point to the build dir, # because otherwise they have different length depending on the build @@ -1554,3 +1576,46 @@ class CudaLinker(PosixDynamicLinkerMixin, DynamicLinker): def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str, suffix: str, soversion: str, darwin_versions: T.Tuple[str, str]) -> T.List[str]: return [] + + +class MetrowerksLinker(DynamicLinker): + + def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice, + *, version: str = 'unknown version'): + super().__init__(exelist, for_machine, '', [], + version=version) + + def fatal_warnings(self) -> T.List[str]: + return ['-w', 'error'] + + def get_allow_undefined_args(self) -> T.List[str]: + return [] + + def get_accepts_rsp(self) -> bool: + return True + + def get_lib_prefix(self) -> str: + return "" + + def get_linker_always_args(self) -> T.List[str]: + return [] + + def get_output_args(self, target: str) -> T.List[str]: + return ['-o', target] + + def get_search_args(self, dirname: str) -> T.List[str]: + return self._apply_prefix('-L' + dirname) + + def invoked_by_compiler(self) -> bool: + return False + + def rsp_file_syntax(self) -> RSPFileSyntax: + return RSPFileSyntax.GCC + + +class MetrowerksLinkerARM(MetrowerksLinker): + id = 'mwldarm' + + +class MetrowerksLinkerEmbeddedPowerPC(MetrowerksLinker): + id = 'mwldeppc' |