From 5ff60499453a390465aac2c60dd743d2c6964797 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Tue, 26 Dec 2023 17:05:34 +0200 Subject: [PATCH] swift: Support swift_args Fixes #12533 --- mesonbuild/backend/ninjabackend.py | 1 + test cases/swift/8 extra args/main.swift | 1 + test cases/swift/8 extra args/meson.build | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 test cases/swift/8 extra args/main.swift create mode 100644 test cases/swift/8 extra args/meson.build diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 0fa4cc91fc79..d675882db4ec 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -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) diff --git a/test cases/swift/8 extra args/main.swift b/test cases/swift/8 extra args/main.swift new file mode 100644 index 000000000000..1ff8e07c7075 --- /dev/null +++ b/test cases/swift/8 extra args/main.swift @@ -0,0 +1 @@ +print("test") diff --git a/test cases/swift/8 extra args/meson.build b/test cases/swift/8 extra args/meson.build new file mode 100644 index 000000000000..ead2ff509fc2 --- /dev/null +++ b/test cases/swift/8 extra args/meson.build @@ -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, +)