Skip to content

Commit faba48d

Browse files
committed
backends: Treat build target as generator only when it's the first arg
Otherwise it might be an argument to a script that just inspects the binary itself.
1 parent 9b8ac9d commit faba48d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

mesonbuild/backend/backends.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,9 @@ def check_clock_skew(self, file_list):
919919
if delta > 0.001:
920920
raise MesonException('Clock skew detected. File {} has a time stamp {:.4f}s in the future.'.format(absf, delta))
921921

922-
def build_target_to_cmd_array(self, bt):
922+
def build_target_to_cmd_array(self, bt, check_cross):
923923
if isinstance(bt, build.BuildTarget):
924-
if isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
924+
if check_cross and isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
925925
if (self.environment.is_cross_build() and
926926
self.environment.exe_wrapper is None and
927927
self.environment.need_exe_wrapper()):
@@ -1061,9 +1061,11 @@ def eval_custom_target_command(self, target, absolute_outputs=False):
10611061
inputs = self.get_custom_target_sources(target)
10621062
# Evaluate the command list
10631063
cmd = []
1064+
index = -1
10641065
for i in target.command:
1066+
index += 1
10651067
if isinstance(i, build.BuildTarget):
1066-
cmd += self.build_target_to_cmd_array(i)
1068+
cmd += self.build_target_to_cmd_array(i, (index == 0))
10671069
continue
10681070
elif isinstance(i, build.CustomTarget):
10691071
# GIR scanner will attempt to execute this binary but

mesonbuild/backend/ninjabackend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ def generate_genlist_for_target(self, genlist, target):
19771977
generator = genlist.get_generator()
19781978
subdir = genlist.subdir
19791979
exe = generator.get_exe()
1980-
exe_arr = self.build_target_to_cmd_array(exe)
1980+
exe_arr = self.build_target_to_cmd_array(exe, True)
19811981
infilelist = genlist.get_inputs()
19821982
outfilelist = genlist.get_outputs()
19831983
extra_dependencies = self.get_custom_target_depend_files(genlist)

mesonbuild/backend/vs2010backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def generate_custom_generator_commands(self, target, parent_node):
121121
infilelist = genlist.get_inputs()
122122
outfilelist = genlist.get_outputs()
123123
source_dir = os.path.join(down, self.build_to_src, genlist.subdir)
124-
exe_arr = self.build_target_to_cmd_array(exe)
124+
exe_arr = self.build_target_to_cmd_array(exe, True)
125125
idgroup = ET.SubElement(parent_node, 'ItemGroup')
126126
for i in range(len(infilelist)):
127127
if len(infilelist) == len(outfilelist):

0 commit comments

Comments
 (0)