summaryrefslogtreecommitdiff
path: root/doc/building_wasm.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/building_wasm.md')
-rw-r--r--doc/building_wasm.md45
1 files changed, 12 insertions, 33 deletions
diff --git a/doc/building_wasm.md b/doc/building_wasm.md
index a4a52ee..8d15bc4 100644
--- a/doc/building_wasm.md
+++ b/doc/building_wasm.md
@@ -4,15 +4,12 @@ This file describes the building and testing of JPEG XL
[Web Assembly](https://webassembly.org/) bundles and wrappers.
These instructions assume an up-to-date Debian/Ubuntu system.
-For other platforms, or if you encounter any difficulties,
-please instead use the [Docker container](developing_in_docker.md).
For the sake of simplicity, it is considered, that the following environment
variables are set:
* `OPT` - path to the directory containing additional software;
- the `emsdk` directory with the Emscripten SDK should reside there;
- in the Docker container (mentioned above) this should be `/opt`
+ the `emsdk` directory with the Emscripten SDK should reside there.
## Requirements
@@ -40,28 +37,6 @@ cd emsdk
./emsdk activate latest
```
-[v8](https://v8.dev/) is a JavaScript engine used for running tests.
-v8 has better WASM SIMD support than NodeJS 14.
-To install it use [JSVU](https://github.com/GoogleChromeLabs/jsvu):
-
-```bash
-# Fix some v8 version know to work well.
-export v8_version="8.5.133"
-
-# Install JSVU
-npm install jsvu -g
-
-# Trick JSVU to install to specific location instead of user "home".
-# Note: "os" flag should match the host OS.
-HOME=$OPT jsvu --os=linux64 "v8@${v8_version}"
-
-# Link v8 binary to version-indepentent path.
-ln -s "$OPT/.jsvu/v8-${v8_version}" "$OPT/.jsvu/v8"
-```
-
-In [Docker container](developing_in_docker.md)
-CMake, Emscripten SDK and V8 are pre-installed.
-
## Building and testing the project
```bash
@@ -69,15 +44,19 @@ CMake, Emscripten SDK and V8 are pre-installed.
# $OPT/emsdk.
source $OPT/emsdk/emsdk_env.sh
-# Specify JS engine binary
-export V8=$OPT/.jsvu/v8
-
-# If building using the jpegxl-builder docker container prefix the following commands with:
-# CMAKE_FLAGS=-I/usr/wasm32/include
-# ex. CMAKE_FLAGS=-I/usr/wasm32/include BUILD_TARGET=wasm32 emconfigure ./ci.sh release
+# This should set the $EMSDK variable.
+# If your node version is <16.4.0, you might need to update to a newer version or override
+# the node binary with a version which supports SIMD:
+echo "NODE_JS='/path/to/node_binary'" >> $EMSDK/.emscripten
-# Either build with regular WASM:
+# Assuming you are in the root level of the cloned libjxl repo,
+# either build with regular WASM:
BUILD_TARGET=wasm32 emconfigure ./ci.sh release
# or with SIMD WASM:
BUILD_TARGET=wasm32 ENABLE_WASM_SIMD=1 emconfigure ./ci.sh release
```
+
+## Example site
+
+Once you have build the wasm binary, you can give it a try by building a site
+that decodes jxl images, see [wasm_demo](../tools/wasm_demo/README.md).