aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-12-17 21:09:26 +0200
committerGitHub <noreply@github.com>2019-12-17 21:09:26 +0200
commita2a9611e1de9313770cc2ef8d6a363da6d8eb6dc (patch)
tree709d39603453ac6683efde7be81ac557a6818b4b /mesonbuild/environment.py
parent8a57b608ad5d732f29a3d3da169b32d83600b42d (diff)
parent47dfe34c8517747d51ef063474e3594c487fde82 (diff)
downloadmeson-a2a9611e1de9313770cc2ef8d6a363da6d8eb6dc.zip
meson-a2a9611e1de9313770cc2ef8d6a363da6d8eb6dc.tar.gz
meson-a2a9611e1de9313770cc2ef8d6a363da6d8eb6dc.tar.bz2
Merge pull request #6065 from dcbaker/pass-options-to-linker-detection
Pass options to linker detection
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 8443a47..26727ad 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -735,6 +735,8 @@ class Environment:
def _guess_win_linker(self, compiler: typing.List[str], comp_class: Compiler,
for_machine: MachineChoice, *,
use_linker_prefix: bool = True) -> 'DynamicLinker':
+ self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
+
# Explicitly pass logo here so that we can get the version of link.exe
if not use_linker_prefix or comp_class.LINKER_PREFIX is None:
check_args = ['/logo', '--version']
@@ -743,6 +745,8 @@ class Environment:
elif isinstance(comp_class.LINKER_PREFIX, list):
check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version']
+ check_args += self.coredata.compiler_options[for_machine][comp_class.language + '_args'].value
+
override = [] # type: typing.List[str]
value = self.binaries[for_machine].lookup_entry('ld')
if value is not None:
@@ -797,7 +801,9 @@ class Environment:
:for_machine: which machine this linker targets
:extra_args: Any additional arguments required (such as a source file)
"""
+ self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
extra_args = typing.cast(typing.List[str], extra_args or [])
+ extra_args += self.coredata.compiler_options[for_machine][comp_class.language + '_args'].value
if isinstance(comp_class.LINKER_PREFIX, str):
check_args = [comp_class.LINKER_PREFIX + '--version'] + extra_args
@@ -1287,7 +1293,9 @@ class Environment:
parts = (err if 'javac' in err else out).split()
if len(parts) > 1:
version = parts[1]
- return JavaCompiler(exelist, version, for_machine, info)
+ comp_class = JavaCompiler
+ self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
+ return comp_class(exelist, version, for_machine, info)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
def detect_cs_compiler(self, for_machine):
@@ -1308,6 +1316,7 @@ class Environment:
cls = MonoCompiler
elif "Visual C#" in out:
cls = VisualStudioCsCompiler
+ self.coredata.add_lang_args(cls.language, cls, for_machine, self)
return cls(comp, version, for_machine, info)
self._handle_exceptions(popen_exceptions, compilers)
@@ -1326,7 +1335,9 @@ class Environment:
raise EnvironmentException('Could not execute Vala compiler "%s"' % ' '.join(exelist))
version = search_version(out)
if 'Vala' in out:
- return ValaCompiler(exelist, version, for_machine, info, is_cross)
+ comp_class = ValaCompiler
+ self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
+ return comp_class(exelist, version, for_machine, info, is_cross)
raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
def detect_rust_compiler(self, for_machine):