Add option 'wasm' to compile to WebAssembly in web export #6994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
e.g.
scons p=javascript wasm=yes
WebAssembly is experimental, so disabled by default.
The standard is still in flux, so the compile toolchain is occasionally broken.
Compiling for WebAssembly requires the
incoming
-branch of Emscripten.Running WebAssembly requires nightly browser builds with WebAssembly flag enabled.
If
LLVM_ROOT
in~/.emscripten
is set to Emscripten's "fastcomp" fork of clang, Godot will be compiled perasm2wasm
(i.e. first compile to asm.js as usual, then translate that to wasm). This method of compilation currently has better chances of finishing successfully.If
LLVM_ROOT
points to clang built with experimental WebAssembly backend (-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly
), the output will be translated pers2wasm
to WebAssembly. This method should eventually offer better performance.The HTML shell file now uses
$GODOT_BASE
, a placeholder for the base filename, instead of$GODOT_JS
,$GODOT_MEM
and$GODOT_FS
.