Skip to content

Commit

Permalink
Path special casing for the Xcode backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Aug 21, 2021
1 parent 12e7b3a commit 267d538
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,14 +1269,18 @@ def get_custom_target_sources(self, target: build.CustomTarget) -> T.List[str]:
elif isinstance(i, build.GeneratedList):
fname = [os.path.join(self.get_target_private_dir(target), p) for p in i.get_outputs()]
elif isinstance(i, build.ExtractedObjects):
fname = [os.path.join(self.get_target_private_dir(i.target), p) for p in i.get_outputs(self)]
outputs = i.get_outputs(self)
fname = self.get_extracted_obj_paths(i.target, outputs)
else:
fname = [i.rel_to_builddir(self.build_to_src)]
if target.absolute_paths:
fname = [os.path.join(self.environment.get_build_dir(), f) for f in fname]
srcs += fname
return srcs

def get_extracted_obj_paths(self, target: build.BuildTarget, outputs: T.List[str]) -> T.List[str]:
return [os.path.join(self.get_target_private_dir(target), p) for p in outputs]

def get_custom_target_depend_files(self, target: build.CustomTarget, absolute_paths: bool = False) -> T.List[str]:
deps: T.List[str] = []
for i in target.depend_files:
Expand Down
6 changes: 5 additions & 1 deletion mesonbuild/backend/xcodebackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ def object_filename_from_source(self, target, source):
if isinstance(source, mesonlib.File):
source = source.fname
stem = os.path.splitext(os.path.basename(source))[0]
return f'{project}.build/{buildtype}/{tname}.build/Objects-normal/{arch}/{stem}.o'
obj_path = f'{project}.build/{buildtype}/{tname}.build/Objects-normal/{arch}/{stem}.o'
return obj_path

def get_extracted_obj_paths(self, target: build.BuildTarget, outputs: T.List[str])-> T.List[str]:
return outputs

def generate(self):
self.serialize_tests()
Expand Down
2 changes: 1 addition & 1 deletion test cases/common/22 object extraction/check-obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

for obj in sys.argv[2:]:
if not os.path.exists(obj):
sys.exit(1)
sys.exit(f'File {obj} not found.')
if sys.argv[1] == 'ninja' and obj not in output:
sys.exit(1)
print('Verified', obj)

0 comments on commit 267d538

Please sign in to comment.