You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for being patient.
It looks like swiftc failing to find the module while generating the C++ header for app_h from the Swift sources and isn't actually building the app target at all. The app_h target is missing the search path to where the Ui.swiftmodule lives.
The easiest way to fix that is to just pass it via the SEARCH_PATHS list so that the header generation finds both the Ui.swiftmodule and the module.modulemap:
Then from there, I think it'll get into confusion between Ui::Window and Window. It's a bit risky to have the two modules with the same name (the Swift module and the C++ modulemap module are both called Ui). I honestly don't know what to expect with how that gets imported.
Anyway, I think this is enough to get you rolling again. I've done some fairly extensive reworking of how the header generation works so that it actually just wraps the base target and doesn't create a separate target (it doesn't automatically propagate include directories so you'll still hit this, though I think I can update it to handle that too. Not 100% sure if that will fix this specific issue though.).
Hey there 👋🏼
First, thanks for this repository, he helped me learn a lot about Swift and CMake and Swift/Cxx interop.
I was experimenting with Swift/Cxx interoperability, especially with consuming a Swift class from C++.
It worked nicely until I needed to import a Swift module from one file to another.
Here is my project structure:
But it does not work as expected:
But when I looked at the build output, I saw
Ui
module files generated:I also tried with:
Like it is done here: https://github.com/apple/swift-cmake-examples/tree/main/2_executable_library
I checked that
app
is linked towindow
target.I wonder if it is not just a CMake knowledge that I miss or something else. I run out of ideas 😅.
The text was updated successfully, but these errors were encountered: