Skip to content

Commit

Permalink
ninja: Wire up Swift link args for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Apr 10, 2024
1 parent ef4f842 commit 2f33f5c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2135,6 +2135,16 @@ def determine_swift_dep_modules(self, target):
result.append(self.swift_module_file_name(l))
return result

def determine_swift_external_dep_link_args(self, target, swiftc):
args = []
for dep in target.get_external_deps():
args += swiftc.get_dependency_link_args(dep)
for d in target.get_dependencies():
if isinstance(d, build.StaticLibrary):
for dep in d.get_external_deps():
args += swiftc.get_dependency_link_args(dep)
return args

def get_swift_link_deps(self, target):
result = []
for l in target.link_targets:
Expand Down Expand Up @@ -2208,6 +2218,7 @@ def generate_swift_target(self, target):
if reldir == '':
reldir = '.'
link_args += ['-L', os.path.normpath(os.path.join(self.environment.get_build_dir(), reldir))]
link_args += self.determine_swift_external_dep_link_args(target, swiftc)
(rel_generated, other_generated) = self.split_swift_generated_sources(target)
abs_generated = [os.path.join(self.environment.get_build_dir(), x) for x in rel_generated]
# We need absolute paths because swiftc needs to be invoked in a subdir
Expand Down

0 comments on commit 2f33f5c

Please sign in to comment.