Basic support for generating C++ header from Swift code #14241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(Requires/follow-up to #13317.)
Adds a new function to generate Swift to C++ bridging header in order to allow calling Swift code from C++.
Also adds a function to get the Swift library search paths, since linking a static Swift library into a C++ program does not automatically link against the Swift standard library. CMake doesn't seem to have this problem but I don't know why. Maybe they use swiftc to link the final binary in this case instead of the C++ linker? I don't like this at all, would love suggestions for how to make this better.
Caveat: using this requires manually setting CXX to the Swift-bundled clang++ (on non-macOS), since it requires special support in the compiler which the normal clang doesn't come with. What would need to happen for this not to be necessary is Meson would have to detect that when a Swift-generated header is used in a C++ target it should automatically use the Swift-bundled clang++. Not sure if this is possible/desirable.
To do:
Ref: