Skip to content

Commit

Permalink
swift: Support swift_args
Browse files Browse the repository at this point in the history
Fixes #12533
  • Loading branch information
noscript authored and dcbaker committed Dec 26, 2023
1 parent f1035e0 commit 5ff6049
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,7 @@ def generate_swift_target(self, target):
srctreedir = os.path.normpath(os.path.join(self.environment.get_build_dir(), self.build_to_src, expdir))
sargs = swiftc.get_include_args(srctreedir, False)
compile_args += sargs
compile_args += target.get_extra_args('swift')
link_args = swiftc.get_output_args(os.path.join(self.environment.get_build_dir(), self.get_target_filename(target)))
link_args += self.build.get_project_link_args(swiftc, target.subproject, target.for_machine)
link_args += self.build.get_global_link_args(swiftc, target.for_machine)
Expand Down
1 change: 1 addition & 0 deletions test cases/swift/8 extra args/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("test")
18 changes: 18 additions & 0 deletions test cases/swift/8 extra args/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project('extra args', 'swift')

trace_fname = 'trace.json'

lib = static_library('main',
'main.swift',
swift_args: [
'-emit-loaded-module-trace',
'-emit-loaded-module-trace-path', '../' + trace_fname
],
)

custom_target('trace_check',
output: trace_fname,
command: ['cat', '@OUTPUT@'],
depends: lib,
build_always: true,
)

0 comments on commit 5ff6049

Please sign in to comment.