tools/binary_size/libsupersize/viewer/caspian/README.md
[TOC]
Caspian is the name for the WebAssembly portion of the SuperSize Tiger Viewer. It also contains a Linux command-line test binary.
This step needs to be only once. Docs: https://emscripten.org/docs/getting_started/downloads.html
cd /usr/local/google/code
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 4.0.9
./emsdk activate 4.0.9
source emsdk_env.sh
# Omit is_official_build=true if developing locally.
gn gen out/caspian --args='enable_caspian=true is_official_build=true treat_warnings_as_errors=false fatal_linker_warnings=false emscripten_path="/usr/local/google/code/emsdk/upstream/emscripten"'
# Build and copy into static/ directory:
( cd out/caspian; autoninja caspian_web && cp wasm/caspian_web.* ../../tools/binary_size/libsupersize/viewer/static/ )
There is a test and a binary that you can run to help with development (and allows debugging outside of the browser).
OUT=$out/linux_debug
autoninja -C $OUT caspian_cli caspian_unittests
$OUT/caspian_cli --help
$OUT/caspian_unittests
# To debug a crash:
lldb $OUT/caspian_cli validatediff supersize_diff.sizediff
Based on this article: https://developer.chrome.com/blog/wasm-debugging-2020/
The one-time setup steps are:
sudo apt-get install google-chrome-unstable)The every-time steps are:
tools/binary_size/libsupersize/viewer/upload_html_viewer.py --localviewer.html and load a file.tree-worker-wasm.js > file://.cc files within it and set breakpoints.cd $PATH_TO_EMSDK
git pull origin main --tags
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
Caspian is a port of the Python implementation, and tries as much as possible to follow the same patterns and names as the Python. Keeping them as similar as possible makes it easier to keep them in sync.
Follow Chrome's C++ styleguide where possible. One notable exception is that
Caspian does not use //base due to the current lack of WASM support in it.