vs: Always use a wrapper for custom target commands

Besides fixing output capture, it also fixes a strange bug in MSBuild
where if the command list is too long, it will remove random
characters from the command list before passing it to the command.

Closes https://github.com/mesonbuild/meson/issues/1417
pull/1486/head
Nirbheek Chauhan 8 years ago committed by Jussi Pakkanen
parent df1480fe11
commit 53795d89df
  1. 11
      mesonbuild/backend/vs2010backend.py
  2. 4
      test cases/common/117 custom target capture/meson.build

@ -403,7 +403,16 @@ class Vs2010Backend(backends.Backend):
# from the target dir, not the build root.
target.absolute_paths = True
(srcs, ofilenames, cmd) = self.eval_custom_target_command(target, True)
ET.SubElement(customstep, 'Command').text = ' '.join(self.quote_arguments(cmd))
# Always use a wrapper because MSBuild eats random characters when
# there are many arguments.
tdir_abs = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
exe_data = self.serialise_executable(target.command[0], cmd[1:],
# All targets run from the target dir
tdir_abs,
capture=ofilenames[0] if target.capture else None)
wrapper_cmd = [sys.executable, self.environment.get_build_command(),
'--internal', 'exe', exe_data]
ET.SubElement(customstep, 'Command').text = ' '.join(self.quote_arguments(wrapper_cmd))
ET.SubElement(customstep, 'Outputs').text = ';'.join(ofilenames)
ET.SubElement(customstep, 'Inputs').text = ';'.join(srcs)
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets')

@ -2,10 +2,6 @@ project('custom target', 'c')
python3 = import('python3').find_python()
if meson.backend().startswith('vs')
error('MESON_SKIP_TEST: capturing of custom target output is broken with the VS backends')
endif
# Note that this will not add a dependency to the compiler executable.
# Code will not be rebuilt if it changes.
comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py')

Loading…
Cancel
Save