aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/xcodebackend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-04-10 21:32:32 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-04-11 23:59:22 +0300
commitbe3efaf1d55b3d0f43aa8a06b23d31364c683029 (patch)
treee29238fb42bbeb9288b4ed1527a08ab6f0550d95 /mesonbuild/backend/xcodebackend.py
parente901581edec38eb3b49c2ba528681a957d18a8df (diff)
downloadmeson-be3efaf1d55b3d0f43aa8a06b23d31364c683029.zip
meson-be3efaf1d55b3d0f43aa8a06b23d31364c683029.tar.gz
meson-be3efaf1d55b3d0f43aa8a06b23d31364c683029.tar.bz2
Xcode: fix linking of static libs that link to other libs.
Diffstat (limited to 'mesonbuild/backend/xcodebackend.py')
-rw-r--r--mesonbuild/backend/xcodebackend.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index f4b0ff7..3923c14 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -753,6 +753,9 @@ class XCodeBackend(backends.Backend):
ntarget_dict.add_item('buildRules', PbxArray())
dep_array = PbxArray()
ntarget_dict.add_item('dependencies', dep_array)
+ # These dependencies only tell Xcode that the deps must be built
+ # before this one. They don't set up linkage or anything
+ # like that. Those are set up in the XCBuildConfiguration.
for lt in self.build_targets[tname].link_targets:
# NOT DOCUMENTED, may need to make different links
# to same target have different targetdependency item.
@@ -941,6 +944,20 @@ class XCodeBackend(backends.Backend):
for target_name, target in self.build_targets.items():
self.generate_single_build_target(objects_dict, target_name, target)
+ def determine_internal_dep_link_args(self, target, buildtype):
+ links_dylib = False
+ dep_libs = []
+ for l in target.link_targets:
+ abs_path = os.path.join(self.environment.get_build_dir(),
+ l.subdir, buildtype, l.get_filename())
+ dep_libs.append("'%s'" % abs_path)
+ if isinstance(l, build.SharedLibrary):
+ links_dylib = True
+ if isinstance(l, build.StaticLibrary):
+ (sub_libs, sub_links_dylib) = self.determine_internal_dep_link_args(l, buildtype)
+ dep_libs += sub_libs
+ links_dylib = links_dylib or sub_links_dylib
+ return (dep_libs, links_dylib)
def generate_single_build_target(self, objects_dict, target_name, target):
for buildtype in self.buildtypes:
@@ -952,12 +969,7 @@ class XCodeBackend(backends.Backend):
cd = os.path.join(d.curdir, sd)
headerdirs.append(os.path.join(self.environment.get_source_dir(), cd))
headerdirs.append(os.path.join(self.environment.get_build_dir(), cd))
- for l in target.link_targets:
- abs_path = os.path.join(self.environment.get_build_dir(),
- l.subdir, buildtype, l.get_filename())
- dep_libs.append("'%s'" % abs_path)
- if isinstance(l, build.SharedLibrary):
- links_dylib = True
+ (dep_libs, links_dylib) = self.determine_internal_dep_link_args(target, buildtype)
if links_dylib:
dep_libs = ['-Wl,-search_paths_first', '-Wl,-headerpad_max_install_names'] + dep_libs
dylib_version = None