Open william-silversmith opened 1 month ago
Thanks for the report, I hope
https://github.com/libjxl/libjxl/blob/main/doc/building_wasm.md
is still up-to-date...
I had some issues following it exactly, though it could be my installation of emconfigure that was busted. I suspect though that it will do what running cmake naively does, which is generate a WASM module + a JS file to run it (the WASM export symbols are minified and the JS module is written to decode it.
(for example)
var _malloc = Module['_malloc'] = (a0) => (_malloc = Module['_malloc'] = wasmExports['n'])(a0);
In my use case, I want to just use the WASM module directly with no JS file generated. I am writing the user interface manually.
The reason I would like the standalone compilation to be integrated is that the project I'm writing this for won't accept my hacked wasm build for an official merge. They want to be able to do reproducible builds. I suppose I could fork the repo, hack it, and reference that, but ideally it would be officially supported.
Hi! I'm trying to integrate a JPEG XL WASM binary into an existing project that uses typescript and has a fairly strict style guide. To do this cleanly, I will need a standalone WASM build. Ideally, the project would provide a CMAKE flag that would generate standalone WASM modules.
I'm not that skilled at using cmake, but I managed to hack the ninja.build file it output to create what appears to be a working version. I'm still trying to get my entire pipeline working, but the WASM seems to load and execute exported functions, though I'm doing something wrong with them.
I ran the following cmake command.
Then I edited the top level ninja.build file under the entry for building
jxl_decoder.js
. I changed the TARGET_FILE extension from.js
to.wasm
and added-s STANDALONE_WASM=1 --no-entry
to the LINK_FLAGS.This successfully generated a standalone WASM file with no accompanying JS file.
Thanks so much for all the effort put into this project!