-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling for Windows #18
Comments
|
There are no Mac dependencies on libgodot, it is a pretty straightforward patch. Would love for someone to look into compiling it, and helping me sort out the CI so we can publish binaries for Windows people. I am happily doing the Mac version, but I don't have a Windows machine around. |
|
@migueldeicaza I have a Windows machine available - I'd be happy to help, I just need some tips to get started. I've cloned your I know from your perspective this must sound very silly - I'm sure there's something obvious I'm missing there. |
|
Good question! I use the script in SwiftGodotKit/Scripts/make-libgodot.xcframework to make the MacOS binary, but the core component is this command line invocation: The script does thing like putting it in a format that is convenient for Xcode, and builds for two platforms - so you can really ignore all of that, but it is a good reference to keep in mind. Let me know if that unblocks you. |
|
Thanks Miguel that's definitely set me on a productive path. I'll report back here with findings over the coming days. Very determined to get this working: I'd love to be able to do cross-platform game development in Swift. |
|
Progress update: What I'm about to share will probably sound a bit obvious to those more well versed in Windows library development than myself. Swift's C++ interoperability depends on Clang C++ Modules (not to be confused with C++20 modules). If you observe the structure of the The structure of the It's not obvious to me how a similar structure could be created on Windows. There's no equivalent of In summary, it seems I've walked onto the bleeding edge of Swift-on-Windows. The crucial question seems to be - How do we create a Clang-module compatible DLL on Windows, and then package that DLL in an equivalent manner to a I'll continue my research. |
|
Hello Just a note that LibGodot does not use c++ interoperability at all. What it uses is the old C interoperability. That one should be working, but I don't know how one would use that |
|
Thanks for nudging me back in the right direction Miguel. I've opened a discussion on the Swift Forums and @compnerd has kindly been replying with more information with respect to making the DLL available to Swift on Windows. With yours and Saleem's help, and some serious learning on my part, I bet this challenge will be solved. |
|
Oh that discussion looks like it is heading in the right direction! Keep me posted, this is exciting |
|
Another progress update, the following is effectively a mirror of the latest post I've made on the Swift Forums, but I thought it good to keep this thread updated as well. Miguel, I thought you might be interested in the references to "plugins" in the compilation failure, as I believe you've performed some plugin wizardry to get SwiftGodot working (though, like so many things on this adventure, I might have a misunderstanding about the meaning of the word "plugin" in this context!). I've managed to prepare a ... with modulemap: I provided the libgodot library to SwiftGodotKit package.swift as a And then invoked Compilation proceeded as follows: With the following error output, the "output" body of which I've snipped due to its verbosity: For now, I'm going to focus on |
|
Can you try the “subst” trick? Your path might be too long. |
|
The The modulemap should be sunk a layer lower into The symbolic link warning is a red herring, it is not fatal. However, that indicates that you do not the @migueldeicaza that is an interesting thought, I'm not sure that it is the cause of this particular failure, though I agree with you that $ echo 'C:\\Users\\Users\\Hugh\\Desktop\\SwiftGodotKit-main\\.build\\plugins\\outputs\\swiftgodot\\SwiftGodot\\CodeGeneratorPlugin\\GeneratedSources\\generated.swiftdeps' | wc -c
149149 << 261 Seems like the swiftdeps didn't get written? It is unclear what the invocation was, but that should be written by the driver 🤔 . Perhaps building with |
|
Miguel, Saleem, Thank you both for your input - It's tremendously motivating to have you both throwing ideas into the ring. We continue to advance - here's a progress update. First, I granted the Next, I used subst S: C:\Users\Hugh\Desktop\SwiftGodotKit-main ... to map my working SwiftGodotKit directory to a temporary ... and, voila! During that build process, the terminal was spammed with Swift on windows linking msvc dll errors ... and a few more, with great input from Saleem. My initial reading indicates that this phenomenon explains the long build times. I will read these threads in depth and work to resolve these warnings. Regardless, I decided to proceed to attempt to build my "minimum example" project, which is extremely similar to Miguels's "trivial example" - It simply attempts to draw a cube. The result is, as expected, the same LNK4217 spam as when building SwiftGodotKit individually. And at the end, the following failure: As discussed earlier, the whole linking process is my greatest knowledge deficiency in working this problem. So any ideas or comments anyone has are most welcome and would be very helpful. My next steps are to thoroughly read the forum threads referenced above, and learn more about LNK4217 and its manifestation in the Swift on Windows context, as I suspect it is related to the I'm very excited at this progress, and I imagine that with a but more research into the linking process, I will be able to clear what feels like the final hurdle. |
|
Note that the LNK4217 warnings are just that - warnings. The issue is in the serialization or deserialization of the missile (I'm uncertain which). However, in your case, you are building with SPM which does not correctly build Swift code and the warnings are expected. If you wish to minimize (Abdulrasool hopefully soon erase) them, you worked need to use CMake for the time being. |
|
those symbols that are missing are part of libgodot. What Godot are you using to build? you must use the libgodot fork from my repositories (it is just plain Godot with the PR for Libgodot merged into it) |
|
Oh I realize something: on windows you might need to declare the public entry points in some kind of public manifest. So those two symbols need to be listed somewhere. I believe windows uses DEF files for that, but that’s the extent of my Windows linker knowledge. |
|
Thanks for that tip off Miguel, I'll have an opportunity to try adding a DEF file later this week. I can confirm am using your libgodot fork to build the Windows DLL. |
|
This is a bug in the implementation of godot. The function is properly attributed with This needs to be conditional on an additional macro so that it is defined to #if defined(_WINDLL)
#if defined(core_EXPORTS)
#define GODOT_API __declspec(dllexport)
#else
#define GODOT_API __declspec(dllimport)
#endif
#else
#define GODOT_API
#endif |
|
Update: I don't have much time to look at this during the holiday period, but I'm excited to continue this thread in the new year. I've attempted to quickly add a DEF file, but have been running in to some obscure behaviour when compiling. I'm still gathering notes before I post back here. compnerd, I'll also try to grok your contribution and make the suggested changes. |
Hi @migueldeicaza, your work is amazing, and I'm very much enjoying exploring SwiftGodot/SwiftGodotKit.
I've had some success using SwiftGodotKit to start a new project on MacOS. Driving Godot from Swift is fantastic. However, I need the project to run on Windows as well.
It seems that the core issue preventing use of SwiftGodotKit on Windows right now is the lack of a Windows version of libgodot. Might the solution be as simple as compiling
libgodoton Windows as a DLL, and using it in place of the MacOS DyLib, retaining the same umbrella header? If so, I'm game to have a go - But I'm guessing there are some gotchas and nuances I should be aware of before I go down that rabbit hole.Let me know how I can help.
The text was updated successfully, but these errors were encountered: