skia2/modules/canvaskit/Makefile
Kevin Lubick 157577b866 [canvaskit,pathkit] Update to emsdk 2.0
There was a break that was solved by adding -lGL to our link
steps. I discovered a few extra flags to aid in debugging builds
and I've left those in (they aren't too noisy IMO).

This changes the base dockerfile to use the official emscripten one.

Code size delta for full build is +5 kb

For future reference, emsdk decides which "library JS" files to
pull in using a83ba99d60/tools/building.py (L1553)
Those JS files live in src (e.g. a83ba99d60/src/library_html5_webgl.js (L222))
and define functions that the C++ code can call.

I'd like to follow-up on what -lEGL is doing.

Also, since the new image no longer has depot_tools, we need
to make docker/skia-wasm-release/Dockerfile install it.

Change-Id: I5a38e61e5080e9c4cb1e0a7e031509bcb107ff86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/311726
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-08-20 14:55:50 +00:00

107 lines
3.8 KiB
Makefile

clean:
rm -rf ../../out/canvaskit_wasm
rm -rf ./canvaskit/bin
$(MAKE) release
release:
# Does an incremental build where possible.
./compile.sh
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin
release_cpu:
# Does an incremental build where possible.
./compile.sh cpu_only
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin
release_viewer:
# Does an incremental build where possible.
./compile.sh viewer
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin
debug:
# Does an incremental build where possible.
./compile.sh debug
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./canvaskit/bin
debug_cpu:
# Does an incremental build where possible.
./compile.sh debug cpu_only
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./canvaskit/bin
experimental_simd:
# Does an incremental build where possible.
./compile.sh simd
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm_experimental_simd/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm_experimental_simd/canvaskit.wasm ./canvaskit/bin
cp ../../out/canvaskit_wasm_experimental_simd/canvaskit.wasm.map ./canvaskit/bin
debug_viewer:
# Does an incremental build where possible.
./compile.sh debug viewer
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./canvaskit/bin
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./canvaskit/bin
profile:
./compile.sh profiling
mkdir -p ./canvaskit/bin
cp ../../out/canvaskit_wasm_profile/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm_profile/canvaskit.wasm ./canvaskit/bin
npm:
rm -rf ./canvaskit/bin
mkdir -p ./canvaskit/bin
# These features are turned off to keep code size smaller for the
# general use case.
./compile.sh release no_skottie no_particles no_rt_shader no_alias_font no_effects_deserialization
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin
mkdir -p ./canvaskit/bin/core
./compile.sh release no_skottie no_particles no_pathops no_rt_shader no_font no_skp_serialization no_effects_deserialization
cp ../../out/canvaskit_wasm/canvaskit.js ./canvaskit/bin/core
cp ../../out/canvaskit_wasm/canvaskit.wasm ./canvaskit/bin/core
local-example:
rm -rf node_modules/canvaskit
mkdir -p node_modules
ln -s ../canvaskit node_modules/canvaskit
echo "Go check out http://localhost:8000/canvaskit/example.html"
python serve.py
test-continuous:
echo "Assuming npm install has been run by user"
echo "Also assuming make debug or release has also been run by a user (if needed)"
npx karma start ./karma.conf.js --no-single-run --watch-poll
test-continuous-headless:
npx karma start ./karma.conf.js --no-single-run --watch-poll --headless
.PHONY: perf
perf:
npx karma start ./karma.bench.conf.js --single-run
node-example:
node ./canvaskit/node.example.js --expose-wasm
docker-compile:
mkdir -p ${SKIA_ROOT}/out/canvaskit_wasm_docker
docker run --rm --volume ${SKIA_ROOT}:/SRC \
--volume ${SKIA_ROOT}/out/canvaskit_wasm_docker:/OUT \
gcr.io/skia-public/canvaskit-emsdk:2.0.0_v1 \
/SRC/infra/canvaskit/build_canvaskit.sh