From 23b5f9b35135eb0e8bb313f18d1d102b2803bfa0 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 9 Mar 2020 12:34:29 -0700 Subject: [PATCH] linkers: Allow optlink to be invoked indirectly --- mesonbuild/environment.py | 2 +- mesonbuild/linkers.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index ece124245..8fa54086d 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -793,7 +793,7 @@ class Environment: exelist=compiler, version=search_version(o), direct=invoked_directly) elif 'OPTLINK' in o: # 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'): out = o or e match = re.search(r'.*(X86|X64|ARM|ARM64).*', out) diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index d6ea0c9e0..83687ad92 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -968,15 +968,22 @@ class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): """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'): # Use optlink instead of link so we don't interfer with other link.exe # 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]: 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): """Cuda linker (nvlink)"""