aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index a2d024a..5d1163b 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -989,6 +989,8 @@ You probably should put it in link_with instead.''')
langs = []
# Check if any of the external libraries were written in this language
for dep in self.external_deps:
+ if dep.language is None:
+ continue
if dep.language not in langs:
langs.append(dep.language)
# Check if any of the internal libraries this target links to were
@@ -999,7 +1001,7 @@ You probably should put it in link_with instead.''')
langs.append(language)
return langs
- def get_clike_dynamic_linker(self):
+ def get_clike_dynamic_linker_and_stdlibs(self):
'''
We use the order of languages in `clike_langs` to determine which
linker to use in case the target has sources compiled with multiple
@@ -1021,12 +1023,19 @@ You probably should put it in link_with instead.''')
for l in clike_langs:
if l in self.compilers or l in dep_langs:
try:
- return all_compilers[l]
+ linker = all_compilers[l]
except KeyError:
raise MesonException(
'Could not get a dynamic linker for build target {!r}. '
'Requires a linker for language "{}", but that is not '
'a project language.'.format(self.name, l))
+ stdlib_args = []
+ added_languages = set()
+ for dl in itertools.chain(self.compilers, dep_langs):
+ if dl != linker.language:
+ stdlib_args += all_compilers[dl].language_stdlib_only_link_flags()
+ added_languages.add(dl)
+ return linker, stdlib_args
m = 'Could not get a dynamic linker for build target {!r}'
raise AssertionError(m.format(self.name))
@@ -1049,7 +1058,8 @@ You probably should put it in link_with instead.''')
2. If the target contains only objects, process_compilers guesses and
picks the first compiler that smells right.
'''
- linker = self.get_clike_dynamic_linker()
+ linker, _ = self.get_clike_dynamic_linker_and_stdlibs()
+ # Mixing many languages with MSVC is not supported yet so ignore stdlibs.
if linker and linker.get_id() == 'msvc':
return True
return False