diff options
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r-- | mesonbuild/backend/backends.py | 8 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 13 | ||||
-rw-r--r-- | mesonbuild/backend/vs2010backend.py | 23 |
3 files changed, 19 insertions, 25 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index ba5bd90..14b189b 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -583,10 +583,10 @@ class Backend: for_machine = MachineChoice.BUILD else: for_machine = MachineChoice.HOST - if not target.is_cross: - # Compile args added from the env: CFLAGS/CXXFLAGS, etc. We want these - # to override all the defaults, but not the per-target compile args. - commands += self.environment.coredata.get_external_args(for_machine, compiler.get_language()) + # Compile args added from the env: CFLAGS/CXXFLAGS, etc, or the cross + # file. We want these to override all the defaults, but not the + # per-target compile args. + commands += self.environment.coredata.get_external_args(for_machine, compiler.get_language()) # Always set -fPIC for shared libraries if isinstance(target, build.SharedLibrary): commands += compiler.get_pic_args() diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 4d1aa3a..5e2f863 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1456,20 +1456,18 @@ int dummy; or langname == 'cs': continue crstr = '' - 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) if compiler.can_linker_accept_rsp(): command_template = ''' command = {executable} @$out.rsp rspfile = $out.rsp - rspfile_content = $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing + rspfile_content = $ARGS {output_args} $in $LINK_ARGS $aliasing ''' else: - command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS {cross_args} $aliasing\n' + command_template = ' command = {executable} $ARGS {output_args} $in $LINK_ARGS $aliasing\n' command = command_template.format( executable=' '.join(compiler.get_linker_exelist()), - cross_args=' '.join([quote_func(i) for i in cross_args]), output_args=' '.join(compiler.get_linker_output_args('$out')) ) description = ' description = Linking target $out.\n' @@ -2494,10 +2492,9 @@ rule FORTRAN_DEP_HACK%s # Add link args added using add_global_link_arguments() # These override per-project link arguments commands += self.build.get_global_link_args(linker, target.is_cross) - 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(for_machine, linker.get_language()) + # 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(for_machine, linker.get_language()) # Now we will add libraries and library paths from various sources diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 6148474..c2f89c8 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -896,14 +896,12 @@ class Vs2010Backend(backends.Backend): for l, args in self.build.global_args.items(): if l in file_args: file_args[l] += args - if not target.is_cross: - # Compile args added from the env or cross file: CFLAGS/CXXFLAGS, - # etc. We want these to override all the defaults, but not the - # per-target compile args. - for key, opt in self.environment.coredata.compiler_options[for_machine].items(): - l, suffix = key.split('_', 1) - if suffix == 'args' and l in file_args: - file_args[l] += opt.value + # Compile args added from the env or cross file: CFLAGS/CXXFLAGS, etc. We want these + # to override all the defaults, but not the per-target compile args. + for key, opt in self.environment.coredata.compiler_options[for_machine].items(): + l, suffix = key.split('_', 1) + if suffix == 'args' and l in file_args: + file_args[l] += opt.value for args in file_args.values(): # This is where Visual Studio will insert target_args, target_defines, # etc, which are added later from external deps (see below). @@ -1058,11 +1056,10 @@ class Vs2010Backend(backends.Backend): # Add link args added using add_global_link_arguments() # These override per-project link arguments extra_link_args += self.build.get_global_link_args(compiler, target.is_cross) - if not target.is_cross: - # Link args added from the env: LDFLAGS, or the cross file. We - # want these to override all the defaults but not the - # per-target link args. - extra_link_args += self.environment.coredata.get_external_link_args(for_machine, compiler.get_language()) + # Link args added from the env: LDFLAGS, or the cross file. We want + # these to override all the defaults but not the per-target link + # args. + extra_link_args += self.environment.coredata.get_external_link_args(for_machine, compiler.get_language()) # Only non-static built targets need link args and link dependencies extra_link_args += target.link_args # External deps must be last because target link libraries may depend on them. |