Using SwiftPM with Emscripten

Hello, I’ve been looking into trying to use Emscripten with Swift, but I’m not sure how I would achieve it best? Does anyone have any suggestions? I’ve tried using the WASM SDK, but it doesn’t seem to support the wasm32-unknown-emscripten target triple.

Hi, thank you for trying out Wasm Swift SDK!

Emscripten is currently not supported by Swift, as we focus on WASI as our primary platform for Wasm.

What's the reason you're looking for Emscripten support instead of considering WASI?

I’m having a go at making a game engine in Swift, and I’m using SDL for input/windowing. SDL only supports Emscripten for web, so I’m sort of stuck with Emscripten.

@needlesslygrim we have a pitch for this now, I hope this is going to unblock your use case: [Pitch] Emscripten Target Support for Swift

1 Like

This is very exciting, thank you! I’ll test once there are pre-built toolchains.

1 Like