diff options
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 9b215b2..87f9b38 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -31,7 +31,7 @@ from .. import dependencies from .. import compilers from ..compilers import CompilerArgs, CCompiler, VisualStudioCCompiler from ..linkers import ArLinker -from ..mesonlib import File, MesonException, OrderedSet +from ..mesonlib import File, MachineChoice, MesonException, OrderedSet from ..mesonlib import get_compiler_for_source, has_path_sep from .backends import CleanTrees from ..build import InvalidArguments @@ -1460,7 +1460,7 @@ int dummy; or langname == 'cs': continue crstr = '' - cross_args = self.environment.properties.host.get_external_link_args(langname) + cross_args = self.environment.coredata.get_external_link_args(MachineChoice.HOST, langname) if is_cross: crstr = '_CROSS' rule = 'rule %s%s_LINKER\n' % (langname, crstr) @@ -2467,6 +2467,11 @@ rule FORTRAN_DEP_HACK%s if not isinstance(target, build.StaticLibrary): commands += self.get_link_whole_args(linker, target) + if self.environment.is_cross_build() and not target.is_cross: + for_machine = MachineChoice.BUILD + else: + for_machine = MachineChoice.HOST + if not isinstance(target, build.StaticLibrary): # Add link args added using add_project_link_arguments() commands += self.build.get_project_link_args(linker, target.subproject, target.is_cross) @@ -2476,7 +2481,7 @@ rule FORTRAN_DEP_HACK%s if not target.is_cross: # Link args added from the env: LDFLAGS. We want these to # override all the defaults but not the per-target link args. - commands += self.environment.coredata.get_external_link_args(linker.get_language()) + commands += self.environment.coredata.get_external_link_args(for_machine, linker.get_language()) # Now we will add libraries and library paths from various sources @@ -2522,7 +2527,7 @@ rule FORTRAN_DEP_HACK%s # to be after all internal and external libraries so that unresolved # symbols from those can be found here. This is needed when the # *_winlibs that we want to link to are static mingw64 libraries. - commands += linker.get_option_link_args(self.environment.coredata.compiler_options) + commands += linker.get_option_link_args(self.environment.coredata.compiler_options[for_machine]) dep_targets = [] dep_targets.extend(self.guess_external_link_dependencies(linker, target, commands, internal)) |