aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets
diff options
context:
space:
mode:
authorKatalin Rebhan <me@dblsaiko.net>2025-02-25 21:26:32 +0100
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-08-02 21:45:01 +0300
commiteefad4a723ce63a0ac02edec7c41d69fa10b14bb (patch)
tree8662fbd313bbdb7d71823b6c6c803bbdd3a03e08 /docs/markdown/snippets
parent6473a727a6907185871758bb554c0850bd00cf6b (diff)
downloadmeson-eefad4a723ce63a0ac02edec7c41d69fa10b14bb.zip
meson-eefad4a723ce63a0ac02edec7c41d69fa10b14bb.tar.gz
meson-eefad4a723ce63a0ac02edec7c41d69fa10b14bb.tar.bz2
Add swift_interoperability_mode kwarg
Diffstat (limited to 'docs/markdown/snippets')
-rw-r--r--docs/markdown/snippets/swift_cxx_interoperability.md16
1 files changed, 13 insertions, 3 deletions
diff --git a/docs/markdown/snippets/swift_cxx_interoperability.md b/docs/markdown/snippets/swift_cxx_interoperability.md
index f18e114..9e324f9 100644
--- a/docs/markdown/snippets/swift_cxx_interoperability.md
+++ b/docs/markdown/snippets/swift_cxx_interoperability.md
@@ -1,13 +1,23 @@
## Swift/C++ interoperability is now supported
It is now possible to create Swift executables that can link to C++ or
-Objective-C++ libraries. Only specifying a bridging header for the Swift
-target is required.
+Objective-C++ libraries. To enable this feature, set the target kwarg
+_swift\_interoperability\_mode_ to 'cpp'.
+
+To import C++ code, specify a bridging header in the Swift target's
+sources, or use another way such as adding a directory containing a
+Clang module map to its include path.
+
+Note: Enabling C++ interoperability in a library target is a breaking
+change. Swift libraries that enable it need their consumers to enable
+it as well, as per [the Swift documentation][1].
Swift 5.9 is required to use this feature. Xcode 15 is required if the
Xcode backend is used.
```meson
lib = static_library('mylib', 'mylib.cpp')
-exe = executable('prog', 'main.swift', 'mylib.h', link_with: lib)
+exe = executable('prog', 'main.swift', 'mylib.h', link_with: lib, swift_interoperability_mode: 'cpp')
```
+
+[1]: https://www.swift.org/documentation/cxx-interop/project-build-setup/#vending-packages-that-enable-c-interoperability