2018-09-20 21:39:31 +00:00
|
|
|
clean:
|
|
|
|
rm -rf ../../out/canvaskit_wasm
|
2021-02-23 14:40:07 +00:00
|
|
|
rm -rf ./npm_build/bin
|
2018-09-20 21:39:31 +00:00
|
|
|
$(MAKE) release
|
|
|
|
|
|
|
|
release:
|
|
|
|
# Does an incremental build where possible.
|
|
|
|
./compile.sh
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin
|
2018-09-20 21:39:31 +00:00
|
|
|
|
2018-10-17 11:57:18 +00:00
|
|
|
release_cpu:
|
|
|
|
# Does an incremental build where possible.
|
2018-11-20 19:07:42 +00:00
|
|
|
./compile.sh cpu_only
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin
|
2018-10-17 11:57:18 +00:00
|
|
|
|
2020-03-25 16:50:35 +00:00
|
|
|
release_viewer:
|
|
|
|
# Does an incremental build where possible.
|
|
|
|
./compile.sh viewer
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin
|
2020-03-25 16:50:35 +00:00
|
|
|
|
2018-09-20 21:39:31 +00:00
|
|
|
debug:
|
|
|
|
# Does an incremental build where possible.
|
|
|
|
./compile.sh debug
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./npm_build/bin
|
|
|
|
#cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./npm_build/bin
|
2018-09-20 21:39:31 +00:00
|
|
|
|
2018-10-17 11:57:18 +00:00
|
|
|
debug_cpu:
|
|
|
|
# Does an incremental build where possible.
|
2018-11-20 19:07:42 +00:00
|
|
|
./compile.sh debug cpu_only
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./npm_build/bin
|
|
|
|
#cp ../../out/canvaskit_wasm_debug/canvaskit.wasm.map ./npm_build/bin
|
2018-10-17 11:57:18 +00:00
|
|
|
|
2020-06-30 22:08:44 +00:00
|
|
|
experimental_simd:
|
|
|
|
# Does an incremental build where possible.
|
|
|
|
./compile.sh simd
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_experimental_simd/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_experimental_simd/canvaskit.wasm ./npm_build/bin
|
2020-06-30 22:08:44 +00:00
|
|
|
|
2020-03-25 16:50:35 +00:00
|
|
|
debug_viewer:
|
|
|
|
# Does an incremental build where possible.
|
|
|
|
./compile.sh debug viewer
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_debug/canvaskit.wasm ./npm_build/bin
|
2020-03-25 16:50:35 +00:00
|
|
|
|
2018-12-03 19:49:15 +00:00
|
|
|
profile:
|
|
|
|
./compile.sh profiling
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_profile/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm_profile/canvaskit.wasm ./npm_build/bin
|
2018-12-03 19:49:15 +00:00
|
|
|
|
2020-01-06 13:11:52 +00:00
|
|
|
npm:
|
2021-02-23 14:40:07 +00:00
|
|
|
rm -rf ./npm_build/bin
|
|
|
|
mkdir -p ./npm_build/bin
|
|
|
|
cp ./CHANGELOG.md ./npm_build/
|
|
|
|
|
|
|
|
mkdir -p ./npm_build/bin/full
|
|
|
|
./compile.sh release
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin/full
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin/full
|
|
|
|
|
2020-01-06 13:11:52 +00:00
|
|
|
# These features are turned off to keep code size smaller for the
|
|
|
|
# general use case.
|
2020-07-20 14:33:32 +00:00
|
|
|
./compile.sh release no_skottie no_particles no_rt_shader no_alias_font no_effects_deserialization
|
2021-02-23 14:40:07 +00:00
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.js ./npm_build/bin
|
|
|
|
cp ../../out/canvaskit_wasm/canvaskit.wasm ./npm_build/bin
|
2020-01-06 13:11:52 +00:00
|
|
|
|
2021-02-23 14:40:07 +00:00
|
|
|
mkdir -p ./npm_build/bin/profiling
|
|
|
|
./compile.sh profiling
|
|
|
|
cp ../../out/canvaskit_wasm_profile/canvaskit.js ./npm_build/bin/profiling
|
|
|
|
cp ../../out/canvaskit_wasm_profile/canvaskit.wasm ./npm_build/bin/profiling
|
2018-12-03 19:49:15 +00:00
|
|
|
|
2021-01-07 18:03:18 +00:00
|
|
|
gm_tests_debug:
|
|
|
|
./compile_gm.sh debug
|
|
|
|
mkdir -p ./out
|
|
|
|
cp ../../out/wasm_gm_tests_debug/wasm_gm_tests.js ./out
|
|
|
|
cp ../../out/wasm_gm_tests_debug/wasm_gm_tests.wasm ./out
|
|
|
|
|
2020-10-08 14:05:07 +00:00
|
|
|
gm_tests:
|
|
|
|
./compile_gm.sh
|
|
|
|
mkdir -p ./out
|
|
|
|
cp ../../out/wasm_gm_tests/wasm_gm_tests.js ./out
|
|
|
|
cp ../../out/wasm_gm_tests/wasm_gm_tests.wasm ./out
|
|
|
|
|
2018-09-20 21:39:31 +00:00
|
|
|
local-example:
|
2018-10-16 14:15:01 +00:00
|
|
|
rm -rf node_modules/canvaskit
|
2018-09-20 21:39:31 +00:00
|
|
|
mkdir -p node_modules
|
2021-02-23 14:40:07 +00:00
|
|
|
ln -s ../npm_build node_modules/canvaskit
|
|
|
|
echo "Go check out http://localhost:8000/npm_build/example.html"
|
2021-10-11 19:47:47 +00:00
|
|
|
python3 ../../tools/serve_wasm.py
|
2018-10-16 14:15:01 +00:00
|
|
|
|
|
|
|
test-continuous:
|
2021-02-23 14:40:07 +00:00
|
|
|
echo "Assuming npm ci has been run by user"
|
2018-10-16 14:15:01 +00:00
|
|
|
echo "Also assuming make debug or release has also been run by a user (if needed)"
|
2018-10-17 11:57:18 +00:00
|
|
|
npx karma start ./karma.conf.js --no-single-run --watch-poll
|
|
|
|
|
2020-05-20 21:24:30 +00:00
|
|
|
test-continuous-headless:
|
|
|
|
npx karma start ./karma.conf.js --no-single-run --watch-poll --headless
|
|
|
|
|
2018-10-17 11:57:18 +00:00
|
|
|
node-example:
|
2021-02-23 14:40:07 +00:00
|
|
|
node ./npm_build/node.example.js --expose-wasm
|
2019-02-22 15:04:06 +00:00
|
|
|
|
|
|
|
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 \
|
2020-08-20 14:47:34 +00:00
|
|
|
gcr.io/skia-public/canvaskit-emsdk:2.0.0_v1 \
|
2019-02-22 15:04:06 +00:00
|
|
|
/SRC/infra/canvaskit/build_canvaskit.sh
|
2020-10-06 14:39:10 +00:00
|
|
|
|
|
|
|
typecheck:
|
2021-02-23 14:40:07 +00:00
|
|
|
echo "Make sure you've run cd npm_build && npm ci recently"
|
|
|
|
cd npm_build && npm run dtslint
|
[infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).
This can be done with the following commands:
- bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard
- bazel build :skia-core --config clang
This pivots slightly from http://review.skia.org/463517
by using config_settings [1] instead of platforms for
the optional features that we control. This pivot was
suggested in [2]
We have BUILD.bazel files in many of the subdirectories
that specify filegroups for the appropriate files. In
an effort to make //BUILD.bazel more readable, it is
the responsibility of these subfolders to deal with
conditionally including certain .h or .cpp files.
This is done using select statements and config_settings
or platform constraints as necessary.
For example, src/gpu/BUILD.bazel will different private
filegroups for each of the supported gpu backends [3]
and a more-visible filegroup called "srcs" that has
the right selection of the private files to be used
for compilation.
An effort has been made to avoid using glob() in our
BUILD.bazel files. These file lists were made by using
`ls -1` and some regex to add in quotes. We might want
to make a helper script to assist with that, if necessary.
To specify which options we have, the settings in
//bazel/common_config_settings/BUILD.bazel have been
redesigned. They make use of a macro `string_flag_with_values`
that removes the boilerplate. Patchset 36 shows what the
file looks like w/o the macro.
The top level BUILD.bazel file will still need to use
some logic to handle defines, because local_defines is
a list of strings, not a list of labels [4].
Suggested Review Order:
- WORKSPACE.bazel to see the new dependencies on the
emsdk toolchain and bazel_skylib
- bazel/common_config_settings/* to see the few settings
defined (we have more to define, see BUILD.gn and
//gn/skia.gni for ideas)
- BUILD.bazel to see the "skia-core" cc_library rule.
See also "gms" and "tests"
- modules/canvaskit/BUILD.bazel to see the use of
the emscripten "wasm_cc_binary" rule, which depends
on the "skia-core", "gms", and "tests" rule. Note that
it only builds some of the gms as a proof of concept.
- The other BUILD.bazel files. Some of these are not
platform or feature dependent (e.g. pathops). Others
are (e.g. gpu).
- All other files.
[1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings
[2] https://github.com/emscripten-core/emsdk/pull/920
[3] In this CL, that's just the webgl one.
[4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines
Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-08 20:26:09 +00:00
|
|
|
|
|
|
|
bazel_gms_sandboxed:
|
|
|
|
# Because emscripten does a lot of extra work, we need to limit the number of jobs or it
|
|
|
|
# can overwhelm even a powerful build system.
|
|
|
|
bazel build :gm-bindings-wasm --compilation_mode opt --cpu=wasm --jobs 8
|
|
|
|
- rm -rf build/
|
|
|
|
mkdir build
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm
|
|
|
|
|
|
|
|
bazel_gms_release:
|
|
|
|
# We use spawn_strategy=local for "everyday" builds because emscripten assumes there
|
|
|
|
# is a cache in the home directory that it needs to fill with compiled versions of libc etc.
|
|
|
|
# https://emscripten.org/docs/tools_reference/emcc.html
|
|
|
|
# By setting spawn_strategy=local, we can avoid recompiling all of this for every compilation
|
|
|
|
# unit, by letting the cache be used (and not dropped from the sandbox), which gets expensive.
|
|
|
|
# Local testing showed using the local strategy sped up a clean build from 9.5 minutes
|
|
|
|
# to 1 minute. https://docs.bazel.build/versions/main/user-manual.html#strategy-options
|
|
|
|
bazel build :gm-bindings-wasm --compilation_mode opt --spawn_strategy=local \
|
|
|
|
--gpu_backend=gl_backend --with_gl_standard=webgl_standard
|
|
|
|
- rm -rf build/
|
|
|
|
mkdir build
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm
|
|
|
|
|
|
|
|
bazel_gms_debug:
|
|
|
|
# See above note about spawn_strategy
|
|
|
|
bazel build :gm-bindings-wasm --compilation_mode dbg --spawn_strategy=local \
|
|
|
|
--gpu_backend=gl_backend --with_gl_standard=webgl_standard
|
|
|
|
- rm -rf build/
|
|
|
|
mkdir build
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.js build/gm-bindings.js
|
|
|
|
cp ../../bazel-bin/modules/canvaskit/gm-bindings-wasm/gm-bindings.wasm build/gm-bindings.wasm
|