Skip to content
 
 

Repository files navigation

FNA-WASM-Build

WASM Build (FNA)

This repo is for automating the build of WebAssembly (WASM) native libraries for FNA and MonoGame, including:

  • SDL3.a - Simple DirectMedia Layer.
  • SDL2.a - Simple DirectMedia Layer (via sdl2-compat)
  • FNA3D.a - 3D graphics library for FNA.
  • FAudio.a - XAudio reimplementation for FNA.
  • openssl - OpenSSL WASM.
  • libgdiplus.a / System.Drawing - Mono GDI+ / System.Drawing for WASM.
  • liba + hot_reload_detour - Library used for MonoMod on WASM.
  • dotnet - Patched dotnet wasm multithreaded runtime for MonoMod on WASM.

There is currently just one workflow:

  1. WASM Build (FNA).

Patches

This fork contains a few patches (and uses SDL3 as the base):

  • SDL3.patch fixes some issues with EM_ASM not being proxied to main thread.
  • SDL2.patch (for sdl2-compat) and SDL3-SDL2.patch (for sdl3) to build a cursed static build of sdl2-compat
  • FNA3D.patch adds -pthread to the CFLAGS so FNA3D is built with WASM threads support.
  • dotnet.patch patches the dotnet runtime so MonoMod can be used.
  • glib.patch disables gio, fuzzing, tools, and docs subdirectories in glib to allow building for WASM without unsupported dependencies.

Usage

Go to the Actions tab and download the .zip artifact from the latest workflow run.
See for further details: https://gist.github.com/TheSpydog/e94c8c23c01615a5a3b2cc1a0857415c (out of date)

Frozen emsdk artifact

The workflow also produces emsdk-frozen.zip (pthread=true build). This archive is a frozen copy of src/mono/browser/emsdk from the patched runtime build, including dotnet-style emsdk_env and .emscripten configuration. It is intended for consumers that need emsdk behavior to match dotnet runtime packaging.

For local generation after building runtime in liba/runtime:

./freeze-emsdk.sh ./liba/runtime ./Binaries/emsdk-frozen.zip

About

Repo for building the FNA WASM libraries. (`-pthread`)

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages