diff options
4 files changed, 58 insertions, 19 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index b0fab16..dca045f 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -448,9 +448,18 @@ class XCodeBackend(backends.Backend): self.target_dependency_map = {} for tname, t in self.build_targets.items(): for target in t.link_targets: - k = (tname, target.get_basename()) - assert(k not in self.target_dependency_map) + if isinstance(target, build.CustomTargetIndex): + k = (tname, target.target.get_basename()) + if k in self.target_dependency_map: + continue + else: + k = (tname, target.get_basename()) + assert(k not in self.target_dependency_map) self.target_dependency_map[k] = self.gen_id() + for tname, t in self.custom_targets.items(): + k = tname + assert(k not in self.target_dependency_map) + self.target_dependency_map[k] = self.gen_id() def generate_pbxdep_map(self): self.pbx_dep_map = {} @@ -996,8 +1005,13 @@ class XCodeBackend(backends.Backend): for lt in self.build_targets[tname].link_targets: # NOT DOCUMENTED, may need to make different links # to same target have different targetdependency item. - idval = self.pbx_dep_map[lt.get_id()] - dep_array.add_item(idval, 'PBXTargetDependency') + if isinstance(lt, build.CustomTarget): + dep_array.add_item(self.pbx_custom_dep_map[lt.get_id()], lt.name) + elif isinstance(lt, build.CustomTargetIndex): + dep_array.add_item(self.pbx_custom_dep_map[lt.target.get_id()], lt.target.name) + else: + idval = self.pbx_dep_map[lt.get_id()] + dep_array.add_item(idval, 'PBXTargetDependency') for o in t.objects: if isinstance(o, build.ExtractedObjects): source_target_id = o.target.get_id() @@ -1317,8 +1331,16 @@ class XCodeBackend(backends.Backend): for l in target.link_targets: if isinstance(target, build.SharedModule) and isinstance(l, build.Executable): continue - abs_path = os.path.join(self.environment.get_build_dir(), - l.subdir, buildtype, l.get_filename()) + if isinstance(l, build.CustomTargetIndex): + rel_dir = self.get_custom_target_output_dir(l.target) + libname = l.get_filename() + elif isinstance(l, build.CustomTarget): + rel_dir = self.get_custom_target_output_dir(l) + libname = l.get_filename() + else: + rel_dir = self.get_target_dir(l) + libname = l.get_filename() + abs_path = os.path.join(self.environment.get_build_dir(), rel_dir, libname) dep_libs.append("'%s'" % abs_path) if isinstance(l, build.SharedLibrary): links_dylib = True @@ -1395,7 +1417,6 @@ class XCodeBackend(backends.Backend): for ofname in o.get_outputs(): if os.path.splitext(ofname)[-1] in LINKABLE_EXTENSIONS: ldargs += [r'\"' + os.path.join(self.environment.get_build_dir(), ofname) + r'\"'] - else: raise RuntimeError(o) if isinstance(target, build.SharedModule): diff --git a/test cases/common/209 link custom/meson.build b/test cases/common/209 link custom/meson.build index 837e960..4d4f655 100644 --- a/test cases/common/209 link custom/meson.build +++ b/test cases/common/209 link custom/meson.build @@ -28,13 +28,17 @@ test('linkcustom2', exe2) # Link whole tests -exe3 = executable('prog3', 'prog.c', link_whole: clib) -test('linkwhole', exe) +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') +else + exe3 = executable('prog3', 'prog.c', link_whole: clib) + test('linkwhole', exe) -d2 = declare_dependency(link_whole: clib) + d2 = declare_dependency(link_whole: clib) -exe4 = executable('prog4', 'prog.c', dependencies: d2) -test('linkwhole2', exe2) + exe4 = executable('prog4', 'prog.c', dependencies: d2) + test('linkwhole2', exe2) +endif # custom_target[i] tests @@ -46,17 +50,21 @@ d_i = declare_dependency(link_with: clib[0]) exe2_i = executable('prog2_i', 'prog.c', dependencies: d_i) test('linkcustom2_i', exe2_i) -shared_library('lib1', 'lib.c', link_whole: clib) - # Link whole tests -exe3_i = executable('prog3_i', 'prog.c', link_whole: clib[0]) -test('linkwhole', exe) +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') +else + shared_library('lib1', 'lib.c', link_whole: clib) + + exe3_i = executable('prog3_i', 'prog.c', link_whole: clib[0]) + test('linkwhole', exe) -d2_i = declare_dependency(link_whole: clib[0]) + d2_i = declare_dependency(link_whole: clib[0]) -exe4_i = executable('prog4_i', 'prog.c', dependencies: d2_i) -test('linkwhole2_i', exe2_i) + exe4_i = executable('prog4_i', 'prog.c', dependencies: d2_i) + test('linkwhole2_i', exe2_i) +endif # Link with custom target diff --git a/test cases/common/210 link custom_i single from multiple/meson.build b/test cases/common/210 link custom_i single from multiple/meson.build index eee1fe1..7aadb17 100644 --- a/test cases/common/210 link custom_i single from multiple/meson.build +++ b/test cases/common/210 link custom_i single from multiple/meson.build @@ -28,6 +28,11 @@ test('linkcustom2', exe2) # Link whole tests +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') + subdir_done() +endif + exe3 = executable('prog3', 'prog.c', link_whole: clib_2) test('linkwhole', exe) diff --git a/test cases/common/211 link custom_i multiple from multiple/meson.build b/test cases/common/211 link custom_i multiple from multiple/meson.build index e5236e5..ede059e 100644 --- a/test cases/common/211 link custom_i multiple from multiple/meson.build +++ b/test cases/common/211 link custom_i multiple from multiple/meson.build @@ -28,6 +28,11 @@ test('linkcustom2', exe2) # Link whole tests +if meson.backend() == 'xcode' + message('Xcode does not support link whole so skipping.') + subdir_done() +endif + exe3 = executable('prog3', 'prog.c', link_whole: clibs) test('linkwhole', exe) |