meson icon indicating copy to clipboard operation
meson copied to clipboard

Add Swift/C++ interoperability support

Open tangalbert919 opened this issue 1 year ago • 1 comments

Integrating Swift into C++/Objective-C++ codebases is now supported as of Swift 5.9. This PR creates two new test cases and updates the Ninja and Xcode backends to take advantage of this.

Right now, the new test cases only handle calling C++/Objective-C++ functions from Swift. Calling Swift methods from C++/Objective-C++ is still being worked on.

tangalbert919 avatar Jun 11 '24 17:06 tangalbert919

I feel like C++ compiler args should be passed to Swift when this is active (or, if not all, at the very least C++ language version). Right now I have to manually add swift_args: ['-Xcc', '-std=c++23'] to the target for it to compile correctly.

edit: Done in #14296

dblsaiko avatar Feb 23 '25 12:02 dblsaiko

Nope, this is a good start to get this working IMO.

I'm changing some of the behavior around the C++ interoperability in my follow-up #14261, and I also want to make it so you have to explicitly enable it like in SwiftPM, since enabling C++ interoperability is an ABI-incompatible change, but that sitll needs a bit more thought put into it.

dblsaiko avatar Jun 20 '25 19:06 dblsaiko