swift-webgpu icon indicating copy to clipboard operation
swift-webgpu copied to clipboard

Windows support\Tutorial?

Open YukiDevExpose opened this issue 1 year ago • 1 comments

I think Windows support and installation tutorial would be appricieated

YukiDevExpose avatar Nov 18 '24 20:11 YukiDevExpose

I did manage to get the demos running on Windows today. The process is definitely more painful than on Mac/Linux currently. Here are some of my findings:

Dawn

  • Dawn was fairly straightforward to build, once I had installed the latest Windows SDK
  • Needed to add --config Release to the cmake build command (not documented by Dawn)
  • By default, cmake wants to install the library to C:\Program Files\Dawn (as the equivalent to /usr/local on other platforms), but I don't know how common this practice actually is on Windows, so I skipped this step.
  • Likewise, I don't know how common it is to use pkg-config files on Windows, so I also skipped this step and just provided all the necessary paths manually to the swift build command (which is documented in the README).

swift-webgpu

  • The code generator (which is normally invoked via a swift build plugin) doesn't seem to run. I don't know whether build plugins just aren't supported on Windows or something is going wrong. It seemed to build the plugin but made no signs of actually running it. For now I just ran the tool manually.

  • ~~Some of the webgpu constants (specifically those based on SIZE_MAX) seem to be imported to Swift as UInt64 rather than UInt, which throws up some errors. To me this seems like a Swift bug, since SIZE_MAX should be a variable type, not a fixed size integer. This can be patched for now with a few modifications to the Swift code.~~

  • ~~There is a slight naming difference between the officially distributed glfw library and what the demos in this package are expecting to link against (glfw3 vs glfw). You can just rename the library, but I think we can just update the link flag in this package to glfw3, since I believe this should be compatible on Mac/Linux as well.~~

So a bit of work needed to make it pain-free, but some of these are simple fixes or changes to the documentation. The code generator plugin may need more of an investigation to see why it is not running automatically.

I'm happy to take recommendations from any Windows folks on the typical/best practices, since I don't use this platform primarily.

henrybetts avatar Dec 11 '24 23:12 henrybetts