Open bernardbaker opened 1 year ago
@jarikomppa hello... Do you have time to look at this?
I did this on OSX to get wasm (using cmake, which you can install with brew install cmake
):
git clone https://github.com/jarikomppa/soloud.git
cd soloud/build
emcmake cmake -DSOLOUD_BACKEND_SDL2=OFF -DSOLOUD_C_API=ON -DSOLOUD_BACKEND_NULL=ON -DSOLOUD_BUILD_DEMOS=ON ../contrib
make
This gives me libsoloud.a, which is a static lib for emscripten. It also builds the demos as wasm.
SoLoud_enumerate.js
SoLoud_enumerate.wasm
SoLoud_null.js
SoLoud_null.wasm
SoLoud_simplest.js
SoLoud_simplest.wasm
SoLoud_welcome.js
SoLoud_welcome.wasm
libsoloud.a
If you want to turn the .a file into a big wasm/js library:
emcc -s LINKABLE=1 -s EXPORT_ALL=1 libsoloud.a -o soloud.js
This exports a ton of random things, so is probably not exactly the right way (would be better to surgically export what you are actually using, from a C file with EMSCRIPTEN_KEEPALIVE
instead of EXPORT_ALL
.)
You can also see some 1-off emscripten-builds in demos/emscripten
, but it looks like the file-paths are messed up for preloaded assets.
Compile source:
Compile WASM:
The command expands to:
The error:
The file with the exported functions:
Operating system: OSX