linkers: Allow optlink to be invoked indirectly

pull/6356/head
Dylan Baker 5 years ago
parent 6d4df978e2
commit 23b5f9b351
  1. 2
      mesonbuild/environment.py
  2. 11
      mesonbuild/linkers.py

@ -793,7 +793,7 @@ class Environment:
exelist=compiler, version=search_version(o), direct=invoked_directly) exelist=compiler, version=search_version(o), direct=invoked_directly)
elif 'OPTLINK' in o: elif 'OPTLINK' in o:
# Opltink's stdout *may* beging with a \r character. # Opltink's stdout *may* beging with a \r character.
return OptlinkDynamicLinker(for_machine, version=search_version(o)) return OptlinkDynamicLinker(compiler, for_machine, version=search_version(o))
elif o.startswith('Microsoft') or e.startswith('Microsoft'): elif o.startswith('Microsoft') or e.startswith('Microsoft'):
out = o or e out = o or e
match = re.search(r'.*(X86|X64|ARM|ARM64).*', out) match = re.search(r'.*(X86|X64|ARM|ARM64).*', out)

@ -968,15 +968,22 @@ class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
"""Digital Mars dynamic linker for windows.""" """Digital Mars dynamic linker for windows."""
def __init__(self, for_machine: mesonlib.MachineChoice, def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice,
*, version: str = 'unknown version'): *, version: str = 'unknown version'):
# Use optlink instead of link so we don't interfer with other link.exe # Use optlink instead of link so we don't interfer with other link.exe
# implementations. # implementations.
super().__init__('optlink', ['optlink.exe'], for_machine, '', [], version=version) super().__init__('optlink', exelist, for_machine, '', [], version=version)
def get_allow_undefined_args(self) -> T.List[str]: def get_allow_undefined_args(self) -> T.List[str]:
return [] return []
def get_debugfile_args(self, targetfile: str) -> T.List[str]:
# Optlink does not generate pdb files.
return []
def get_always_args(self) -> T.List[str]:
return []
class CudaLinker(PosixDynamicLinkerMixin, DynamicLinker): class CudaLinker(PosixDynamicLinkerMixin, DynamicLinker):
"""Cuda linker (nvlink)""" """Cuda linker (nvlink)"""

Loading…
Cancel
Save