libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

building_wasm.md (1929B)


      1 # Building WASM artifacts
      2 
      3 This file describes the building and testing of JPEG XL
      4 [Web Assembly](https://webassembly.org/) bundles and wrappers.
      5 
      6 These instructions assume an up-to-date Debian/Ubuntu system.
      7 
      8 For the sake of simplicity, it is considered, that the following environment
      9 variables are set:
     10 
     11  * `OPT` - path to the directory containing additional software;
     12    the `emsdk` directory with the Emscripten SDK should reside there.
     13 
     14 ## Requirements
     15 
     16 [CMake](https://cmake.org/) is used as a build system. To install it, follow
     17 [Debian build instructions](developing_in_debian.md).
     18 
     19 [Emscripten SDK](https://emscripten.org/) is required for building
     20 WebAssembly artifacts. To install it, follow the
     21 [Download and Install](https://emscripten.org/docs/getting_started/downloads.html)
     22 guide:
     23 
     24 ```bash
     25 cd $OPT
     26 
     27 # Get the emsdk repo.
     28 git clone https://github.com/emscripten-core/emsdk.git
     29 
     30 # Enter that directory.
     31 cd emsdk
     32 
     33 # Download and install the latest SDK tools.
     34 ./emsdk install latest
     35 
     36 # Make the "latest" SDK "active" for the current user. (writes ~/.emscripten file)
     37 ./emsdk activate latest
     38 ```
     39 
     40 ## Building and testing the project
     41 
     42 ```bash
     43 # Setup EMSDK and other environment variables. In practice EMSDK is set to be
     44 # $OPT/emsdk.
     45 source $OPT/emsdk/emsdk_env.sh
     46 
     47 # This should set the $EMSDK variable.
     48 # If your node version is <16.4.0, you might need to update to a newer version or override
     49 # the node binary with a version which supports SIMD:
     50 echo "NODE_JS='/path/to/node_binary'" >> $EMSDK/.emscripten
     51 
     52 # Assuming you are in the root level of the cloned libjxl repo,
     53 # either build with regular WASM:
     54 BUILD_TARGET=wasm32 emconfigure ./ci.sh release
     55 # or with SIMD WASM:
     56 BUILD_TARGET=wasm32 ENABLE_WASM_SIMD=1 emconfigure ./ci.sh release
     57 ```
     58 
     59 ## Example site
     60 
     61 Once you have build the wasm binary, you can give it a try by building a site
     62 that decodes jxl images, see [wasm_demo](../tools/wasm_demo/README.md).