Merge branch 'vs-extraargs'

pull/485/head
Jussi Pakkanen 9 years ago
commit 1d89d091f8
  1. 9
      mesonbuild/backend/backends.py
  2. 8
      mesonbuild/backend/ninjabackend.py
  3. 23
      mesonbuild/backend/vs2010backend.py

@ -381,6 +381,15 @@ class Backend():
exe_arr = exe.get_command() exe_arr = exe.get_command()
return exe_arr return exe_arr
def replace_extra_args(self, args, genlist):
final_args = []
for a in args:
if a == '@EXTRA_ARGS@':
final_args += genlist.get_extra_args()
else:
final_args.append(a)
return final_args
def eval_custom_target_command(self, target, absolute_paths=False): def eval_custom_target_command(self, target, absolute_paths=False):
if not absolute_paths: if not absolute_paths:
ofilenames = [os.path.join(self.get_target_dir(target), i) for i in target.output] ofilenames = [os.path.join(self.get_target_dir(target), i) for i in target.output]

@ -1348,13 +1348,7 @@ rule FORTRAN_DEP_HACK
relout = self.get_target_private_dir(target) relout = self.get_target_private_dir(target)
args = [x.replace("@SOURCE_DIR@", self.build_to_src).replace("@BUILD_DIR@", relout) args = [x.replace("@SOURCE_DIR@", self.build_to_src).replace("@BUILD_DIR@", relout)
for x in args] for x in args]
final_args = [] cmdlist = exe_arr + self.replace_extra_args(args, genlist)
for a in args:
if a == '@EXTRA_ARGS@':
final_args += genlist.get_extra_args()
else:
final_args.append(a)
cmdlist = exe_arr + final_args
elem = NinjaBuildElement(self.all_outputs, outfiles, 'CUSTOM_COMMAND', infilename) elem = NinjaBuildElement(self.all_outputs, outfiles, 'CUSTOM_COMMAND', infilename)
if len(extra_dependencies) > 0: if len(extra_dependencies) > 0:
elem.add_dep(extra_dependencies) elem.add_dep(extra_dependencies)

@ -80,26 +80,24 @@ class Vs2010Backend(backends.Backend):
exe = generator.get_exe() exe = generator.get_exe()
infilelist = genlist.get_infilelist() infilelist = genlist.get_infilelist()
outfilelist = genlist.get_outfilelist() outfilelist = genlist.get_outfilelist()
if isinstance(exe, build.BuildTarget): exe_arr = self.exe_object_to_cmd_array(exe)
exe_file = os.path.join(self.environment.get_build_dir(), self.get_target_filename(exe))
else:
exe_file = exe.get_command()[0]
base_args = generator.get_arglist() base_args = generator.get_arglist()
target_private_dir = self.relpath(self.get_target_private_dir(target), self.get_target_dir(target))
for i in range(len(infilelist)): for i in range(len(infilelist)):
if len(infilelist) == len(outfilelist): if len(infilelist) == len(outfilelist):
sole_output = os.path.join(self.get_target_private_dir(target), outfilelist[i]) sole_output = os.path.join(target_private_dir, outfilelist[i])
else: else:
sole_output = '' sole_output = ''
curfile = infilelist[i] curfile = infilelist[i]
infilename = os.path.join(self.environment.get_source_dir(), curfile) infilename = os.path.join(self.environment.get_source_dir(), curfile)
outfiles = genlist.get_outputs_for(curfile) outfiles = genlist.get_outputs_for(curfile)
outfiles = [os.path.join(self.get_target_private_dir(target), of) for of in outfiles] outfiles = [os.path.join(target_private_dir, of) for of in outfiles]
all_output_files += outfiles all_output_files += outfiles
args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)\ args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)\
for x in base_args] for x in base_args]
args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", self.get_target_private_dir(target)) args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir()).replace("@BUILD_DIR@", target_private_dir)
for x in args] for x in args]
fullcmd = [exe_file] + args fullcmd = exe_arr + self.replace_extra_args(args, genlist)
commands.append(' '.join(self.special_quote(fullcmd))) commands.append(' '.join(self.special_quote(fullcmd)))
inputs.append(infilename) inputs.append(infilename)
outputs.extend(outfiles) outputs.extend(outfiles)
@ -584,11 +582,7 @@ class Vs2010Backend(backends.Backend):
relpath = h.rel_to_builddir(proj_to_src_root) relpath = h.rel_to_builddir(proj_to_src_root)
ET.SubElement(inc_hdrs, 'CLInclude', Include=relpath) ET.SubElement(inc_hdrs, 'CLInclude', Include=relpath)
for h in gen_hdrs: for h in gen_hdrs:
if isinstance(h, str): ET.SubElement(inc_hdrs, 'CLInclude', Include=h)
relpath = h
else:
relpath = h.rel_to_builddir(proj_to_src_root)
ET.SubElement(inc_hdrs, 'CLInclude', Include = relpath)
if len(sources) + len(gen_src) + len(pch_sources) > 0: if len(sources) + len(gen_src) + len(pch_sources) > 0:
inc_src = ET.SubElement(root, 'ItemGroup') inc_src = ET.SubElement(root, 'ItemGroup')
for s in sources: for s in sources:
@ -600,8 +594,7 @@ class Vs2010Backend(backends.Backend):
if basename in self.sources_conflicts[target.get_id()]: if basename in self.sources_conflicts[target.get_id()]:
ET.SubElement(inc_cl, 'ObjectFileName').text = "$(IntDir)" + self.object_filename_from_source(target, s) ET.SubElement(inc_cl, 'ObjectFileName').text = "$(IntDir)" + self.object_filename_from_source(target, s)
for s in gen_src: for s in gen_src:
relpath = self.relpath(s, target.subdir) inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=s)
inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath)
self.add_pch(inc_cl, proj_to_src_dir, pch_sources, s) self.add_pch(inc_cl, proj_to_src_dir, pch_sources, s)
self.add_additional_options(s, inc_cl, extra_args, additional_options_set) self.add_additional_options(s, inc_cl, extra_args, additional_options_set)
for lang in pch_sources: for lang in pch_sources:

Loading…
Cancel
Save