Skip to content

WebAssembly support #447

@migueldeicaza

Description

@migueldeicaza

We would like to make it so that developers that want to use SwiftGodot can target Wasm, a popular platform for Godot to be deployed to.

This issue is intended to keep track of the various findings, it will be edited as we find out more information, so this text will change.

Here is roughly where we stand right now:

  1. Godot seems to use the Emscripten ABI
  2. Swift/Wasm seems to use the WASI API, and these are different
  3. We use a lot of Macros, and SwiftWasm does not currently support it, but there is a patch coming soon Support macros when cross-compiling swiftlang/swift-package-manager#7118

While SwiftWASM only supports the executable target, it seems that in the Wasm world, even regular executables can be treated as libraries, so we would need to figure out a way of stitching those together. One possible problem with this approach is that currently we might assume that the extension and Godot share the same memory address space so this could be a problem.

Things that we could also consider:

  1. Compiling Godot as a library
  2. Have our build system link Godot with the SwiftGodot target, like SwiftGodotKit in a way.

Discussion links

Initial discussion on using SwiftWasm for Godot:
https://discord.com/channels/780838335798706197/802944960881098752/1208500336671854662

Recent discussion:

https://discord.com/channels/780838335798706197/790246707648135229/1225627478471610398

Resoures

Setting up Swift for WASM: https://book.swiftwasm.org/getting-started/setup.html

SwiftGodot without Macros dependency, useful to prototype, courtesy of @PadraigK: https://github.com/PadraigK/SwiftGodotLite/tree/main

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions