aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py38
1 files changed, 10 insertions, 28 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 91c5b0f..48dfb11 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -235,39 +235,21 @@ class Backend():
self.write_benchmark_file(datafile)
return (test_data, benchmark_data)
- def determine_linker(self, target, src):
+ def determine_linker(self, target):
+ '''
+ If we're building a static library, there is only one static linker.
+ Otherwise, we query the target for the dynamic linker.
+ '''
if isinstance(target, build.StaticLibrary):
if target.is_cross:
return self.build.static_cross_linker
else:
return self.build.static_linker
- if target.is_cross:
- compilers = self.build.cross_compilers
- else:
- compilers = self.build.compilers
- if len(compilers) == 1:
- return compilers[0]
- # Currently a bit naive. C++ must
- # be linked with a C++ compiler, but
- # otherwise we don't care. This will
- # become trickier if and when Fortran
- # and the like become supported.
- cpp = None
- for c in compilers:
- if c.get_language() == 'cpp':
- cpp = c
- break
- if cpp is not None:
- for s in src:
- if c.can_compile(s):
- return cpp
- for c in compilers:
- if c.get_language() == 'vala':
- continue
- for s in src:
- if c.can_compile(s):
- return c
- raise AssertionError("BUG: Couldn't determine linker for sources {!r}".format(src))
+ l = target.get_clike_dynamic_linker()
+ if not l:
+ m = "Couldn't determine linker for target {!r}"
+ raise MesonException(m.format(target.name))
+ return l
def object_filename_from_source(self, target, source):
if isinstance(source, mesonlib.File):