Xcode: fix file objects in various places.
This commit is contained in:
parent
07117c4225
commit
d116d94f92
|
@ -487,13 +487,17 @@ class XCodeBackend(backends.Backend):
|
||||||
if isinstance(o, build.ExtractedObjects):
|
if isinstance(o, build.ExtractedObjects):
|
||||||
# Extracted objects do not live in "the Xcode world".
|
# Extracted objects do not live in "the Xcode world".
|
||||||
continue
|
continue
|
||||||
else:
|
if isinstance(o, mesonlib.File):
|
||||||
|
o = os.path.join(o.subdir, o.fname)
|
||||||
|
if isinstance(o, str):
|
||||||
o = os.path.join(t.subdir, o)
|
o = os.path.join(t.subdir, o)
|
||||||
k = (tname, o)
|
k = (tname, o)
|
||||||
assert(k not in sel.buildfile_ids)
|
assert(k not in self.buildfile_ids)
|
||||||
self.buildfile_ids[k] = self.gen_id()
|
self.buildfile_ids[k] = self.gen_id()
|
||||||
assert(k not in self.fileref_ids)
|
assert(k not in self.fileref_ids)
|
||||||
self.fileref_ids[k] = self.gen_id()
|
self.fileref_ids[k] = self.gen_id()
|
||||||
|
else:
|
||||||
|
raise RuntimeError('Unknown input type ' + str(o))
|
||||||
|
|
||||||
def generate_source_phase_map(self):
|
def generate_source_phase_map(self):
|
||||||
self.source_phase = {}
|
self.source_phase = {}
|
||||||
|
@ -597,12 +601,15 @@ class XCodeBackend(backends.Backend):
|
||||||
# by hand in linker flags. It is also not particularly
|
# by hand in linker flags. It is also not particularly
|
||||||
# clear how to define build files in Xcode's file format.
|
# clear how to define build files in Xcode's file format.
|
||||||
continue
|
continue
|
||||||
|
if isinstance(o, mesonlib.File):
|
||||||
|
o = os.path.join(o.subdir, o.fname)
|
||||||
|
elif isinstance(o, str):
|
||||||
o = os.path.join(t.subdir, o)
|
o = os.path.join(t.subdir, o)
|
||||||
idval = self.buildfile_ids[(tname, o)]
|
idval = self.buildfile_ids[(tname, o)]
|
||||||
k = (tname, s)
|
k = (tname, o)
|
||||||
fileref = self.fileref_ids[k]
|
fileref = self.fileref_ids[k]
|
||||||
assert(k not in self.targetfile_ids)
|
assert(o not in self.filemap)
|
||||||
self.targetfile_ids[k] = idval
|
self.filemap[o] = idval
|
||||||
fullpath = os.path.join(self.environment.get_source_dir(), o)
|
fullpath = os.path.join(self.environment.get_source_dir(), o)
|
||||||
fullpath2 = fullpath
|
fullpath2 = fullpath
|
||||||
o_dict = PbxDict()
|
o_dict = PbxDict()
|
||||||
|
@ -736,15 +743,23 @@ class XCodeBackend(backends.Backend):
|
||||||
if isinstance(o, build.ExtractedObjects):
|
if isinstance(o, build.ExtractedObjects):
|
||||||
# Same as with pbxbuildfile.
|
# Same as with pbxbuildfile.
|
||||||
continue
|
continue
|
||||||
|
if isinstance(o, mesonlib.File):
|
||||||
|
fullpath = o.absolute_path(self.environment.get_source_dir(), self.environment.get_build_dir())
|
||||||
|
o = os.path.join(o.subdir, o.fname)
|
||||||
|
else:
|
||||||
o = os.path.join(t.subdir, o)
|
o = os.path.join(t.subdir, o)
|
||||||
idval = self.fileref_ids[(tname, o)]
|
|
||||||
fileref = self.filemap[o]
|
|
||||||
fullpath = os.path.join(self.environment.get_source_dir(), o)
|
fullpath = os.path.join(self.environment.get_source_dir(), o)
|
||||||
fullpath2 = fullpath
|
idval = self.fileref_ids[(tname, o)]
|
||||||
|
rel_name = mesonlib.relpath(fullpath, self.environment.get_source_dir())
|
||||||
o_dict = PbxDict()
|
o_dict = PbxDict()
|
||||||
|
name = os.path.basename(o)
|
||||||
objects_dict.add_item(idval, o_dict, fullpath)
|
objects_dict.add_item(idval, o_dict, fullpath)
|
||||||
o_dict.add_item('isa', 'PBXBuildFile')
|
o_dict.add_item('isa', 'PBXFileReference')
|
||||||
o_dict.add_item('fileRef', fileref, fullpath2)
|
o_dict.add_item('explicitFileType', '"' + self.get_xcodetype(o) + '"')
|
||||||
|
o_dict.add_item('fileEncoding', '4')
|
||||||
|
o_dict.add_item('name', f'"{name}"')
|
||||||
|
o_dict.add_item('path', f'"{rel_name}"')
|
||||||
|
o_dict.add_item('sourceTree', 'SOURCE_ROOT')
|
||||||
for tname, idval in self.target_filemap.items():
|
for tname, idval in self.target_filemap.items():
|
||||||
target_dict = PbxDict()
|
target_dict = PbxDict()
|
||||||
objects_dict.add_item(idval, target_dict, tname)
|
objects_dict.add_item(idval, target_dict, tname)
|
||||||
|
@ -902,6 +917,9 @@ class XCodeBackend(backends.Backend):
|
||||||
if isinstance(o, build.ExtractedObjects):
|
if isinstance(o, build.ExtractedObjects):
|
||||||
# Do not show built object files in the project tree.
|
# Do not show built object files in the project tree.
|
||||||
continue
|
continue
|
||||||
|
if isinstance(o, mesonlib.File):
|
||||||
|
o = os.path.join(o.subdir, o.fname)
|
||||||
|
else:
|
||||||
o = os.path.join(t.subdir, o)
|
o = os.path.join(t.subdir, o)
|
||||||
source_file_children.add_item(self.fileref_ids[(tname, o)], o)
|
source_file_children.add_item(self.fileref_ids[(tname, o)], o)
|
||||||
source_files_dict.add_item('name', '"Source files"')
|
source_files_dict.add_item('name', '"Source files"')
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
project('object generator', 'c')
|
project('object generator', 'c')
|
||||||
|
|
||||||
|
if meson.backend() == 'xcode'
|
||||||
|
error('MESON_SKIP_TEST object-only libraries not supported in Xcode. Patches welcome.')
|
||||||
|
endif
|
||||||
|
|
||||||
# FIXME: Note that this will not add a dependency to the compiler executable.
|
# FIXME: Note that this will not add a dependency to the compiler executable.
|
||||||
# Code will not be rebuilt if it changes.
|
# Code will not be rebuilt if it changes.
|
||||||
comp = find_program('obj_generator.py')
|
comp = find_program('obj_generator.py')
|
||||||
|
|
Loading…
Reference in New Issue