diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-02-25 11:36:31 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-02-27 16:35:02 -0800 |
commit | 654f427759d5aa3be55d8929b18c17a2b8fcac69 (patch) | |
tree | 9674ab5e7276344a6f1b1c5e9028744633a00ef3 /mesonbuild/compilers | |
parent | 771b0d3ffbc7b034b436d4ad27be7d0a1da6b3cd (diff) | |
download | meson-654f427759d5aa3be55d8929b18c17a2b8fcac69.zip meson-654f427759d5aa3be55d8929b18c17a2b8fcac69.tar.gz meson-654f427759d5aa3be55d8929b18c17a2b8fcac69.tar.bz2 |
compilers/linkers: Add a representation for wasm-ld
Emscripten does have a stand alone linker, wasm-ld. This patch adds the
linker, adds detection for the linker, and removes the IsLinkerMixin for
emscripten. This is a little more correct, and makes the code a lot
cleaner and more robust.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/c.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/cpp.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/emscripten.py | 20 |
3 files changed, 4 insertions, 24 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index f3ed9e8..e17d655 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -27,7 +27,7 @@ from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler from .mixins.clang import ClangCompiler from .mixins.elbrus import ElbrusCompiler from .mixins.pgi import PGICompiler -from .mixins.islinker import BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin +from .mixins.islinker import LinkerEnvVarsMixin from .mixins.emscripten import EmscriptenMixin from .compilers import ( gnu_winlibs, @@ -133,7 +133,7 @@ class AppleClangCCompiler(ClangCCompiler): _C18_VERSION = '>=11.0.0' -class EmscriptenCCompiler(EmscriptenMixin, BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin, ClangCCompiler): +class EmscriptenCCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs): if not is_cross: diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 2a244e9..db7875b 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -36,7 +36,7 @@ from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler from .mixins.clang import ClangCompiler from .mixins.elbrus import ElbrusCompiler from .mixins.pgi import PGICompiler -from .mixins.islinker import BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin +from .mixins.islinker import LinkerEnvVarsMixin from .mixins.emscripten import EmscriptenMixin if T.TYPE_CHECKING: @@ -201,7 +201,7 @@ class AppleClangCPPCompiler(ClangCPPCompiler): pass -class EmscriptenCPPCompiler(EmscriptenMixin, BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin, ClangCPPCompiler): +class EmscriptenCPPCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCPPCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs): if not is_cross: diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py index ee86ce4..10f4b25 100644 --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -18,7 +18,6 @@ import os.path import typing as T from ... import coredata -from ...mesonlib import MesonException if T.TYPE_CHECKING: from ..environment import Environment @@ -26,18 +25,6 @@ if T.TYPE_CHECKING: class EmscriptenMixin: - def get_option_link_args(self, options): - return [] - - def get_soname_args(self, *args, **kwargs): - raise MesonException('Emscripten does not support shared libraries.') - - def get_allow_undefined_link_args(self) -> T.List[str]: - return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'] - - def get_linker_output_args(self, output: str) -> T.List[str]: - return ['-o', output] - def _get_compile_output(self, dirname, mode): # In pre-processor mode, the output is sent to stdout and discarded if mode == 'preprocess': @@ -54,13 +41,6 @@ class EmscriptenMixin: def thread_flags(self, env: 'Environment') -> T.List[str]: return ['-s', 'USE_PTHREADS=1'] - def thread_link_flags(self, env: 'Environment') -> T.List[str]: - args = ['-s', 'USE_PTHREADS=1'] - count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int - if count: - args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)]) - return args - def get_options(self): opts = super().get_options() opts.update({ |