0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-02 04:40:09 -05:00

🎉 Use custom skia binaries for wasm render

This commit is contained in:
Alejandro Alonso 2024-12-11 10:47:43 +01:00
parent 25a672b958
commit f50c7a70c2
5 changed files with 52 additions and 44 deletions

View file

@ -228,7 +228,7 @@ jobs:
name: "cargo tests"
working_directory: "./render-wasm"
command: |
cargo test
./test
workflows:
penpot:

71
render-wasm/Cargo.lock generated
View file

@ -18,17 +18,21 @@ dependencies = [
]
[[package]]
name = "bindgen"
version = "0.69.5"
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bindgen"
version = "0.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f"
dependencies = [
"bitflags",
"cexpr",
"clang-sys",
"itertools",
"lazy_static",
"lazycell",
"log",
"prettyplease",
"proc-macro2",
@ -37,7 +41,6 @@ dependencies = [
"rustc-hash",
"shlex",
"syn",
"which",
]
[[package]]
@ -183,15 +186,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "indexmap"
version = "2.6.0"
@ -229,12 +223,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lazycell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.161"
@ -306,10 +294,10 @@ dependencies = [
]
[[package]]
name = "once_cell"
version = "1.20.2"
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "prettyplease"
@ -460,15 +448,14 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "skia-bindings"
version = "0.78.2"
version = "0.80.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29880a81b088de322e9c5306236c70761a61b5fa4df3c15c93bad3ce890ce34c"
checksum = "179ebe08aee2634b22ef4d2a1a9370aaa39dfe619a702fc0793d491a26c05cbb"
dependencies = [
"bindgen",
"cc",
"flate2",
"heck",
"lazy_static",
"regex",
"serde_json",
"tar",
@ -477,13 +464,27 @@ dependencies = [
[[package]]
name = "skia-safe"
version = "0.78.2"
version = "0.80.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f15700ac678c06649077495acbba07e7ae01e5ca46b7dc18213f2c3477ada71"
checksum = "41f1a96bec5198699d49e9c6a46aea27033958521c971d9186ae015a0dbecb7b"
dependencies = [
"base64",
"bitflags",
"lazy_static",
"percent-encoding",
"skia-bindings",
"skia-svg-macros",
]
[[package]]
name = "skia-svg-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "044dd2233c9717a74f75197f3e7f0a966db2127c0ffb5e05013b480a9b75b2c7"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -563,18 +564,6 @@ version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "windows-sys"
version = "0.52.0"

View file

@ -12,7 +12,7 @@ path = "src/main.rs"
[dependencies]
gl = "0.14.0"
skia-safe = { version = "0.78.2", features = ["gl"] }
skia-safe = { version = "0.80.1", default-features = false, features = ["gl", "svg", "textlayout", "binary-cache"]}
uuid = { version = "1.11.0", features = ["v4"] }
[profile.release]

View file

@ -6,7 +6,18 @@ else
export _BUILD_MODE=${1:-debug};
fi
export EMCC_CFLAGS="--no-entry -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s MAX_WEBGL_VERSION=2 -s MODULARIZE=1 -s EXPORT_NAME=createRustSkiaModule -s EXPORTED_RUNTIME_METHODS=GL -s ENVIRONMENT=web -s EXPORT_ES6=1 -sMODULARIZE"
export EMCC_CFLAGS="--no-entry \
-Os \
-sASSERTIONS=1 \
-sALLOW_TABLE_GROWTH=1 \
-sALLOW_MEMORY_GROWTH=1 \
-sENVIRONMENT=web \
-sERROR_ON_UNDEFINED_SYMBOLS=0 \
-sMAX_WEBGL_VERSION=2 \
-sMODULARIZE=1 \
-sEXPORT_NAME=createRustSkiaModule \
-sEXPORTED_RUNTIME_METHODS=GL \
-sEXPORT_ES6=1"
EMSDK_QUIET=1 . /usr/local/emsdk/emsdk_env.sh;
. /usr/local/cargo/env
@ -22,6 +33,8 @@ if [ "$_BUILD_MODE" = "release" ]; then
_CARGO_PARAMS="--release $_CARGO_PARAMS"
fi
export SKIA_BINARIES_URL="https://github.com/penpot/skia-binaries/releases/download/0.80.1-1/skia-binaries-9e7d2684a17084095aef-wasm32-unknown-emscripten-gl-svg-textlayout.tar.gz"
pushd $_SCRIPT_DIR;
cargo build $_CARGO_PARAMS

View file

@ -1,2 +1,8 @@
#!/usr/bin/env bash
_SCRIPT_DIR=$(dirname $0);
export SKIA_BINARIES_URL="https://github.com/rust-skia/skia-binaries/releases/download/0.80.0/skia-binaries-9e7d2684a17084095aef-x86_64-unknown-linux-gnu-egl-gl-svg-textlayout-vulkan-wayland-webpd-webpe-x11.tar.gz"
pushd $_SCRIPT_DIR;
cargo test --bin render_wasm -- --show-output
popd