2018-09-20 21:39:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2018 Google LLC
|
|
|
|
#
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
|
|
|
|
# This expects the environment variable EMSDK to be set
|
|
|
|
if [[ ! -d $EMSDK ]]; then
|
2019-10-15 14:15:08 +00:00
|
|
|
cat >&2 << "EOF"
|
|
|
|
Be sure to set the EMSDK environment variable to the location of Emscripten SDK:
|
|
|
|
|
|
|
|
https://emscripten.org/docs/getting_started/downloads.html
|
|
|
|
EOF
|
2018-09-20 21:39:31 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Navigate to SKIA_HOME from where this file is located.
|
|
|
|
pushd $BASE_DIR/../..
|
|
|
|
|
|
|
|
source $EMSDK/emsdk_env.sh
|
2018-10-09 13:36:35 +00:00
|
|
|
EMCC=`which emcc`
|
|
|
|
EMCXX=`which em++`
|
2019-08-27 06:45:14 +00:00
|
|
|
EMAR=`which emar`
|
2018-09-20 21:39:31 +00:00
|
|
|
|
2020-11-17 20:30:44 +00:00
|
|
|
RELEASE_CONF="-Oz --closure 1 -DSK_RELEASE --pre-js $BASE_DIR/release.js"
|
|
|
|
EXTRA_CFLAGS="\"-DSK_RELEASE\","
|
2020-03-25 16:50:35 +00:00
|
|
|
IS_OFFICIAL_BUILD="true"
|
2020-01-06 15:38:52 +00:00
|
|
|
|
|
|
|
# Tracing will be disabled in release/profiling unless this flag is seen. Tracing will
|
|
|
|
# be on debug builds always.
|
|
|
|
if [[ $@ != *force_tracing* ]] ; then
|
|
|
|
RELEASE_CONF+=" -DSK_DISABLE_TRACING"
|
|
|
|
EXTRA_CFLAGS+="\"-DSK_DISABLE_TRACING\","
|
|
|
|
fi
|
|
|
|
|
2018-09-20 21:39:31 +00:00
|
|
|
if [[ $@ == *debug* ]]; then
|
|
|
|
echo "Building a Debug build"
|
2020-09-21 12:13:19 +00:00
|
|
|
EXTRA_CFLAGS="\"-DSK_DEBUG\","
|
2020-12-04 14:10:39 +00:00
|
|
|
RELEASE_CONF="-O0 --js-opts 0 -s DEMANGLE_SUPPORT=1 -s ASSERTIONS=1 -s GL_ASSERTIONS=1 -g3 \
|
2018-12-17 16:08:36 +00:00
|
|
|
--source-map-base /node_modules/canvaskit/bin/ -DSK_DEBUG --pre-js $BASE_DIR/debug.js"
|
2018-10-16 14:15:01 +00:00
|
|
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_debug"}
|
2018-12-03 19:49:15 +00:00
|
|
|
elif [[ $@ == *profiling* ]]; then
|
|
|
|
echo "Building a build for profiling"
|
2020-01-06 15:38:52 +00:00
|
|
|
RELEASE_CONF+=" --profiling-funcs --closure 0"
|
2018-12-03 19:49:15 +00:00
|
|
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_profile"}
|
2020-07-28 19:20:07 +00:00
|
|
|
elif [[ $@ == *simd* ]]; then
|
|
|
|
echo "Building with SIMD operations"
|
|
|
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm_experimental_simd"}
|
2018-10-16 14:15:01 +00:00
|
|
|
else
|
|
|
|
BUILD_DIR=${BUILD_DIR:="out/canvaskit_wasm"}
|
2018-09-20 21:39:31 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-15 16:58:33 +00:00
|
|
|
if [[ $@ == *simd* ]]; then
|
|
|
|
RELEASE_CONF+=" -msimd128"
|
2020-09-21 12:13:19 +00:00
|
|
|
EXTRA_CFLAGS+="\"-msimd128\","
|
2020-07-15 16:58:33 +00:00
|
|
|
fi
|
|
|
|
|
2018-10-16 14:15:01 +00:00
|
|
|
mkdir -p $BUILD_DIR
|
2020-01-02 13:16:51 +00:00
|
|
|
# sometimes the .a files keep old symbols around - cleaning them out makes sure
|
|
|
|
# we get a fresh build.
|
|
|
|
rm -f $BUILD_DIR/*.a
|
2018-10-16 14:15:01 +00:00
|
|
|
|
2019-03-28 16:46:40 +00:00
|
|
|
GN_GPU="skia_enable_gpu=true skia_gl_standard = \"webgl\""
|
|
|
|
GN_GPU_FLAGS="\"-DSK_DISABLE_LEGACY_SHADERCONTEXT\","
|
2020-08-19 18:30:58 +00:00
|
|
|
WASM_GPU="-lGL -DSK_SUPPORT_GPU=1 -DSK_GL \
|
2019-10-16 14:17:05 +00:00
|
|
|
-DSK_DISABLE_LEGACY_SHADERCONTEXT --pre-js $BASE_DIR/cpu.js --pre-js $BASE_DIR/gpu.js\
|
|
|
|
-s USE_WEBGL2=1"
|
2018-10-16 14:15:01 +00:00
|
|
|
if [[ $@ == *cpu* ]]; then
|
|
|
|
echo "Using the CPU backend instead of the GPU backend"
|
2018-10-11 12:51:55 +00:00
|
|
|
GN_GPU="skia_enable_gpu=false"
|
2018-10-16 14:15:01 +00:00
|
|
|
GN_GPU_FLAGS=""
|
2021-07-12 21:02:21 +00:00
|
|
|
WASM_GPU="-DSK_SUPPORT_GPU=0 -DSK_ENABLE_SKSL --pre-js $BASE_DIR/cpu.js -s USE_WEBGL2=0"
|
2018-10-11 12:51:55 +00:00
|
|
|
fi
|
|
|
|
|
2020-01-14 13:39:09 +00:00
|
|
|
SKP_JS="--pre-js $BASE_DIR/skp.js"
|
2020-07-20 14:33:32 +00:00
|
|
|
GN_SKP_FLAGS=""
|
2020-01-14 13:39:09 +00:00
|
|
|
WASM_SKP="-DSK_SERIALIZE_SKP"
|
2020-07-20 14:32:40 +00:00
|
|
|
if [[ $@ == *no_skp_serialization* ]]; then
|
|
|
|
# This saves about 20kb compressed.
|
2020-01-14 13:39:09 +00:00
|
|
|
SKP_JS=""
|
2020-07-20 14:32:40 +00:00
|
|
|
WASM_SKP=""
|
2020-07-20 14:33:32 +00:00
|
|
|
GN_SKP_FLAGS="\"-DSK_DISABLE_EFFECT_DESERIALIZATION\","
|
|
|
|
fi
|
|
|
|
if [[ $@ == *no_effects_deserialization* ]]; then
|
|
|
|
# This saves about 60kb compressed.
|
|
|
|
echo "disabling effects deserialization"
|
|
|
|
GN_SKP_FLAGS="\"-DSK_DISABLE_EFFECT_DESERIALIZATION\","
|
2020-01-14 13:39:09 +00:00
|
|
|
fi
|
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
SKOTTIE_JS="--pre-js $BASE_DIR/skottie.js"
|
2019-03-07 16:48:56 +00:00
|
|
|
SKOTTIE_BINDINGS="$BASE_DIR/skottie_bindings.cpp"
|
2019-02-22 15:04:06 +00:00
|
|
|
|
|
|
|
SKOTTIE_LIB="$BUILD_DIR/libskottie.a \
|
|
|
|
$BUILD_DIR/libsksg.a"
|
|
|
|
|
2018-10-11 12:51:55 +00:00
|
|
|
if [[ $@ == *no_skottie* ]]; then
|
|
|
|
echo "Omitting Skottie"
|
2019-02-28 15:06:18 +00:00
|
|
|
SKOTTIE_JS=""
|
2019-02-22 15:04:06 +00:00
|
|
|
SKOTTIE_LIB=""
|
|
|
|
SKOTTIE_BINDINGS=""
|
2018-10-11 12:51:55 +00:00
|
|
|
fi
|
|
|
|
|
2021-07-01 16:12:52 +00:00
|
|
|
GN_VIEWER="skia_use_expat=false skia_enable_skgpu_v2=false"
|
2020-03-25 16:50:35 +00:00
|
|
|
VIEWER_BINDINGS=""
|
|
|
|
VIEWER_LIB=""
|
|
|
|
|
|
|
|
if [[ $@ == *viewer* ]]; then
|
|
|
|
echo "Including viewer"
|
2021-07-01 16:12:52 +00:00
|
|
|
GN_VIEWER="skia_use_expat=true skia_enable_skgpu_v2=false"
|
2020-03-25 16:50:35 +00:00
|
|
|
VIEWER_BINDINGS="$BASE_DIR/viewer_bindings.cpp"
|
|
|
|
VIEWER_LIB="$BUILD_DIR/libviewer_wasm.a"
|
|
|
|
IS_OFFICIAL_BUILD="false"
|
|
|
|
fi
|
|
|
|
|
2019-02-22 15:04:06 +00:00
|
|
|
MANAGED_SKOTTIE_BINDINGS="\
|
2018-11-29 16:38:12 +00:00
|
|
|
-DSK_INCLUDE_MANAGED_SKOTTIE=1 \
|
2020-01-02 13:16:51 +00:00
|
|
|
modules/skottie/utils/SkottieUtils.cpp"
|
|
|
|
if [[ $@ == *no_managed_skottie* || $@ == *no_skottie* ]]; then
|
2018-11-29 16:38:12 +00:00
|
|
|
echo "Omitting managed Skottie"
|
2019-02-22 15:04:06 +00:00
|
|
|
MANAGED_SKOTTIE_BINDINGS="-DSK_INCLUDE_MANAGED_SKOTTIE=0"
|
2018-11-29 16:38:12 +00:00
|
|
|
fi
|
|
|
|
|
2019-11-27 15:34:18 +00:00
|
|
|
PARTICLES_JS="--pre-js $BASE_DIR/particles.js"
|
2019-03-06 14:32:55 +00:00
|
|
|
PARTICLES_BINDINGS="$BASE_DIR/particles_bindings.cpp"
|
|
|
|
PARTICLES_LIB="$BUILD_DIR/libparticles.a"
|
|
|
|
|
|
|
|
if [[ $@ == *no_particles* ]]; then
|
|
|
|
echo "Omitting Particles"
|
2019-11-27 15:34:18 +00:00
|
|
|
PARTICLES_JS=""
|
2019-03-06 14:32:55 +00:00
|
|
|
PARTICLES_BINDINGS=""
|
|
|
|
PARTICLES_LIB=""
|
|
|
|
fi
|
|
|
|
|
2020-01-02 13:16:51 +00:00
|
|
|
if [[ $@ != *no_particles* || $@ != *no_skottie* ]] ; then
|
|
|
|
PARTICLES_BINDINGS+=" modules/skresources/src/SkResources.cpp"
|
|
|
|
fi
|
|
|
|
|
2020-01-06 13:10:05 +00:00
|
|
|
WASM_PATHOPS="-DSK_INCLUDE_PATHOPS"
|
|
|
|
PATHOPS_JS="--pre-js $BASE_DIR/pathops.js"
|
|
|
|
if [[ $@ == *no_pathops* ]] ; then
|
2020-07-20 14:32:40 +00:00
|
|
|
# This saves about 2kb compressed.
|
2020-01-06 13:10:05 +00:00
|
|
|
WASM_PATHOPS=""
|
|
|
|
PATHOPS_JS=""
|
|
|
|
fi
|
|
|
|
|
2020-01-06 13:11:52 +00:00
|
|
|
WASM_RT_SHADER="-DSK_INCLUDE_RUNTIME_EFFECT"
|
|
|
|
RT_SHADER_JS="--pre-js $BASE_DIR/rt_shader.js"
|
|
|
|
if [[ $@ == *no_rt_shader* ]] ; then
|
|
|
|
WASM_RT_SHADER=""
|
|
|
|
RT_SHADER_JS=""
|
|
|
|
fi
|
|
|
|
|
2021-01-29 13:37:41 +00:00
|
|
|
MATRIX_HELPER_JS="--pre-js $BASE_DIR/matrix.js"
|
|
|
|
if [[ $@ == *no_matrix* ]]; then
|
|
|
|
echo "Omitting matrix helper code"
|
|
|
|
MATRIX_HELPER_JS=""
|
|
|
|
fi
|
|
|
|
|
2018-12-10 17:41:26 +00:00
|
|
|
HTML_CANVAS_API="--pre-js $BASE_DIR/htmlcanvas/preamble.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/util.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/color.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/font.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/canvas2dcontext.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/htmlcanvas.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/imagedata.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/lineargradient.js \
|
2018-12-17 21:01:36 +00:00
|
|
|
--pre-js $BASE_DIR/htmlcanvas/path2d.js \
|
2018-12-10 17:41:26 +00:00
|
|
|
--pre-js $BASE_DIR/htmlcanvas/pattern.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/radialgradient.js \
|
|
|
|
--pre-js $BASE_DIR/htmlcanvas/postamble.js "
|
2021-01-29 13:37:41 +00:00
|
|
|
if [[ $@ == *no_canvas* || $@ == *no_matrix* ]]; then
|
|
|
|
# Note: HTML Canvas bindings depend on the matrix helpers.
|
2018-10-19 18:34:34 +00:00
|
|
|
echo "Omitting bindings for HTML Canvas API"
|
|
|
|
HTML_CANVAS_API=""
|
|
|
|
fi
|
|
|
|
|
2020-06-03 17:20:37 +00:00
|
|
|
GN_FONT="skia_enable_fontmgr_custom_directory=false "
|
2020-11-10 14:13:22 +00:00
|
|
|
WOFF2_FONT="skia_use_freetype_woff2=true"
|
2019-09-26 17:20:50 +00:00
|
|
|
FONT_CFLAGS=""
|
2020-06-03 17:20:37 +00:00
|
|
|
BUILTIN_FONT=""
|
2020-01-06 13:10:05 +00:00
|
|
|
FONT_JS="--pre-js $BASE_DIR/font.js"
|
2018-12-12 15:35:13 +00:00
|
|
|
if [[ $@ == *no_font* ]]; then
|
2019-09-26 17:20:50 +00:00
|
|
|
echo "Omitting the built-in font(s), font manager and all code dealing with fonts"
|
|
|
|
FONT_CFLAGS="-DSK_NO_FONTS"
|
2020-11-10 14:13:22 +00:00
|
|
|
WOFF2_FONT=""
|
2020-01-06 13:10:05 +00:00
|
|
|
FONT_JS=""
|
2020-06-03 17:20:37 +00:00
|
|
|
GN_FONT+="skia_enable_fontmgr_custom_embedded=false skia_enable_fontmgr_custom_empty=false"
|
2019-08-06 18:11:13 +00:00
|
|
|
elif [[ $@ == *no_embedded_font* ]]; then
|
|
|
|
echo "Omitting the built-in font(s)"
|
2020-06-03 17:20:37 +00:00
|
|
|
GN_FONT+="skia_enable_fontmgr_custom_embedded=false skia_enable_fontmgr_custom_empty=true"
|
2018-12-12 15:35:13 +00:00
|
|
|
else
|
|
|
|
# Generate the font's binary file (which is covered by .gitignore)
|
|
|
|
python tools/embed_resources.py \
|
|
|
|
--name SK_EMBEDDED_FONTS \
|
|
|
|
--input $BASE_DIR/fonts/NotoMono-Regular.ttf \
|
|
|
|
--output $BASE_DIR/fonts/NotoMono-Regular.ttf.cpp \
|
|
|
|
--align 4
|
2020-06-03 17:20:37 +00:00
|
|
|
BUILTIN_FONT="$BASE_DIR/fonts/NotoMono-Regular.ttf.cpp"
|
|
|
|
GN_FONT+="skia_enable_fontmgr_custom_embedded=true skia_enable_fontmgr_custom_empty=false"
|
2018-12-12 15:35:13 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-10 14:13:22 +00:00
|
|
|
if [[ $@ == *no_woff2* ]]; then
|
|
|
|
WOFF2_FONT="skia_use_freetype_woff2=false"
|
|
|
|
fi
|
|
|
|
|
2020-05-07 20:25:41 +00:00
|
|
|
if [[ $@ == *no_alias_font* ]]; then
|
2020-09-21 12:13:19 +00:00
|
|
|
EXTRA_CFLAGS+="\"-DCANVASKIT_NO_ALIAS_FONT\","
|
2020-05-07 20:25:41 +00:00
|
|
|
FONT_CFLAGS+=" -DCANVASKIT_NO_ALIAS_FONT"
|
|
|
|
fi
|
|
|
|
|
2019-10-28 16:03:52 +00:00
|
|
|
GN_SHAPER="skia_use_icu=true skia_use_system_icu=false skia_use_harfbuzz=true skia_use_system_harfbuzz=false"
|
2021-07-27 18:02:28 +00:00
|
|
|
SHAPER_LIB="$BUILD_DIR/libskunicode.a \
|
|
|
|
$BUILD_DIR/libharfbuzz.a \
|
2019-02-22 15:04:06 +00:00
|
|
|
$BUILD_DIR/libicu.a"
|
2020-01-02 13:16:51 +00:00
|
|
|
if [[ $@ == *primitive_shaper* ]] || [[ $@ == *no_font* ]]; then
|
2019-02-22 15:04:06 +00:00
|
|
|
echo "Using the primitive shaper instead of the harfbuzz/icu one"
|
2019-02-22 20:55:39 +00:00
|
|
|
GN_SHAPER="skia_use_icu=false skia_use_harfbuzz=false"
|
2019-02-22 15:04:06 +00:00
|
|
|
SHAPER_LIB=""
|
|
|
|
fi
|
|
|
|
|
2019-10-03 15:22:08 +00:00
|
|
|
PARAGRAPH_JS="--pre-js $BASE_DIR/paragraph.js"
|
|
|
|
PARAGRAPH_LIB="$BUILD_DIR/libskparagraph.a"
|
|
|
|
PARAGRAPH_BINDINGS="-DSK_INCLUDE_PARAGRAPH=1 \
|
2021-04-20 17:49:29 +00:00
|
|
|
$BASE_DIR/paragraph_bindings.cpp \
|
|
|
|
$BASE_DIR/paragraph_bindings_gen.cpp"
|
2019-10-03 15:22:08 +00:00
|
|
|
|
2020-01-02 13:16:51 +00:00
|
|
|
if [[ $@ == *no_paragraph* ]] || [[ $@ == *primitive_shaper* ]] || [[ $@ == *no_font* ]]; then
|
|
|
|
echo "Omitting paragraph (must have fonts and non-primitive shaper)"
|
2019-11-15 20:25:34 +00:00
|
|
|
PARAGRAPH_JS=""
|
|
|
|
PARAGRAPH_LIB=""
|
|
|
|
PARAGRAPH_BINDINGS=""
|
|
|
|
fi
|
|
|
|
|
2020-03-18 13:15:17 +00:00
|
|
|
DO_DECODE="true"
|
|
|
|
if [[ $@ == *no_codecs* ]]; then
|
|
|
|
echo "Omitting codecs"
|
|
|
|
DO_DECODE="false"
|
|
|
|
ENCODE_PNG="false"
|
|
|
|
ENCODE_JPEG="false"
|
|
|
|
ENCODE_WEBP="false"
|
|
|
|
else
|
|
|
|
|
|
|
|
ENCODE_PNG="true"
|
|
|
|
if [[ $@ == *no_encode_png* ]]; then
|
|
|
|
ENCODE_PNG="false"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ENCODE_JPEG="false"
|
|
|
|
if [[ $@ == *force_encode_jpeg* ]]; then
|
|
|
|
ENCODE_JPEG="true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
ENCODE_WEBP="false"
|
|
|
|
if [[ $@ == *force_encode_webp* ]]; then
|
|
|
|
ENCODE_WEBP="true"
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi # no_codecs
|
2019-11-15 20:25:34 +00:00
|
|
|
|
2018-10-09 13:36:35 +00:00
|
|
|
# Turn off exiting while we check for ninja (which may not be on PATH)
|
|
|
|
set +e
|
|
|
|
NINJA=`which ninja`
|
|
|
|
if [[ -z $NINJA ]]; then
|
|
|
|
git clone "https://chromium.googlesource.com/chromium/tools/depot_tools.git" --depth 1 $BUILD_DIR/depot_tools
|
|
|
|
NINJA=$BUILD_DIR/depot_tools/ninja
|
|
|
|
fi
|
|
|
|
# Re-enable error checking
|
|
|
|
set -e
|
2018-09-20 21:39:31 +00:00
|
|
|
|
2019-03-04 22:41:56 +00:00
|
|
|
./bin/fetch-gn
|
|
|
|
|
2018-09-20 21:39:31 +00:00
|
|
|
echo "Compiling bitcode"
|
|
|
|
|
|
|
|
# Inspired by https://github.com/Zubnix/skia-wasm-port/blob/master/build_bindings.sh
|
|
|
|
./bin/gn gen ${BUILD_DIR} \
|
|
|
|
--args="cc=\"${EMCC}\" \
|
|
|
|
cxx=\"${EMCXX}\" \
|
2019-08-27 06:45:14 +00:00
|
|
|
ar=\"${EMAR}\" \
|
2020-01-28 15:39:56 +00:00
|
|
|
extra_cflags=[\"-s\", \"WARN_UNALIGNED=1\", \"-s\", \"MAIN_MODULE=1\",
|
2020-01-14 13:39:09 +00:00
|
|
|
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\",
|
2020-01-28 15:39:56 +00:00
|
|
|
\"-DSK_FORCE_8_BYTE_ALIGNMENT\",
|
2018-10-17 13:46:00 +00:00
|
|
|
${GN_GPU_FLAGS}
|
2020-01-14 13:39:09 +00:00
|
|
|
${GN_SKP_FLAGS}
|
2018-10-02 15:33:52 +00:00
|
|
|
${EXTRA_CFLAGS}
|
|
|
|
] \
|
2018-09-20 21:39:31 +00:00
|
|
|
is_debug=false \
|
2020-03-25 16:50:35 +00:00
|
|
|
is_official_build=${IS_OFFICIAL_BUILD} \
|
2018-09-20 21:39:31 +00:00
|
|
|
is_component_build=false \
|
2019-04-23 12:38:07 +00:00
|
|
|
werror=true \
|
2018-09-20 21:39:31 +00:00
|
|
|
target_cpu=\"wasm\" \
|
|
|
|
\
|
2019-10-03 18:18:23 +00:00
|
|
|
skia_use_angle=false \
|
2018-09-20 21:39:31 +00:00
|
|
|
skia_use_dng_sdk=false \
|
2020-08-19 18:30:58 +00:00
|
|
|
skia_use_webgl=true \
|
2018-10-02 15:33:52 +00:00
|
|
|
skia_use_fontconfig=false \
|
2018-09-20 21:39:31 +00:00
|
|
|
skia_use_freetype=true \
|
2018-10-02 15:33:52 +00:00
|
|
|
skia_use_libheif=false \
|
2020-03-18 13:15:17 +00:00
|
|
|
skia_use_libjpeg_turbo_decode=${DO_DECODE} \
|
|
|
|
skia_use_libjpeg_turbo_encode=${ENCODE_JPEG} \
|
|
|
|
skia_use_libpng_decode=${DO_DECODE} \
|
|
|
|
skia_use_libpng_encode=${ENCODE_PNG} \
|
|
|
|
skia_use_libwebp_decode=${DO_DECODE} \
|
|
|
|
skia_use_libwebp_encode=${ENCODE_WEBP} \
|
2018-10-02 15:33:52 +00:00
|
|
|
skia_use_lua=false \
|
2018-09-20 21:39:31 +00:00
|
|
|
skia_use_piex=false \
|
2019-10-28 13:05:54 +00:00
|
|
|
skia_use_system_freetype2=false \
|
2019-10-03 15:22:08 +00:00
|
|
|
skia_use_system_libjpeg_turbo=false \
|
2020-01-08 13:02:37 +00:00
|
|
|
skia_use_system_libpng=false \
|
|
|
|
skia_use_system_libwebp=false \
|
2019-10-28 16:03:52 +00:00
|
|
|
skia_use_system_zlib=false\
|
2018-10-02 15:33:52 +00:00
|
|
|
skia_use_vulkan=false \
|
2019-10-28 13:05:54 +00:00
|
|
|
skia_use_wuffs=true \
|
2018-09-20 21:39:31 +00:00
|
|
|
skia_use_zlib=true \
|
|
|
|
\
|
2019-02-22 15:04:06 +00:00
|
|
|
${GN_SHAPER} \
|
|
|
|
${GN_GPU} \
|
2019-04-16 17:31:25 +00:00
|
|
|
${GN_FONT} \
|
2020-11-10 14:13:22 +00:00
|
|
|
${WOFF2_FONT} \
|
2020-05-28 20:04:53 +00:00
|
|
|
${GN_VIEWER} \
|
2019-02-22 15:04:06 +00:00
|
|
|
\
|
|
|
|
skia_enable_skshaper=true \
|
2019-10-03 15:22:08 +00:00
|
|
|
skia_enable_skparagraph=true \
|
2018-09-20 21:39:31 +00:00
|
|
|
skia_enable_pdf=false"
|
|
|
|
|
2020-03-25 16:50:35 +00:00
|
|
|
# Build all the libs we will need below
|
|
|
|
parse_targets() {
|
|
|
|
for LIBPATH in $@; do
|
|
|
|
basename $LIBPATH
|
|
|
|
done
|
|
|
|
}
|
|
|
|
${NINJA} -C ${BUILD_DIR} libskia.a libskshaper.a \
|
|
|
|
$(parse_targets $SKOTTIE_LIB $VIEWER_LIB $PARTICLES_LIB $SHAPER_LIB $PARAGRAPH_LIB)
|
2018-09-20 21:39:31 +00:00
|
|
|
|
|
|
|
export EMCC_CLOSURE_ARGS="--externs $BASE_DIR/externs.js "
|
|
|
|
|
|
|
|
echo "Generating final wasm"
|
|
|
|
|
2020-09-18 19:27:35 +00:00
|
|
|
# Disable '-s STRICT=1' outside of Linux until
|
|
|
|
# https://github.com/emscripten-core/emscripten/issues/12118 is resovled.
|
|
|
|
STRICTNESS="-s STRICT=1"
|
|
|
|
if [[ `uname` != "Linux" ]]; then
|
|
|
|
echo "Disabling '-s STRICT=1'. See: https://github.com/emscripten-core/emscripten/issues/12118"
|
|
|
|
STRICTNESS=""
|
|
|
|
fi
|
|
|
|
|
2019-02-22 15:04:06 +00:00
|
|
|
# Emscripten prefers that the .a files go last in order, otherwise, it
|
2018-10-19 13:33:12 +00:00
|
|
|
# may drop symbols that it incorrectly thinks aren't used. One day,
|
|
|
|
# Emscripten will use LLD, which may relax this requirement.
|
2020-08-20 14:47:34 +00:00
|
|
|
EMCC_DEBUG=1 ${EMCXX} \
|
2018-09-20 21:39:31 +00:00
|
|
|
$RELEASE_CONF \
|
2019-04-23 17:05:21 +00:00
|
|
|
-I. \
|
2019-02-22 15:04:06 +00:00
|
|
|
-Ithird_party/icu \
|
2019-04-22 18:24:54 +00:00
|
|
|
-Ithird_party/skcms \
|
2019-10-03 15:22:08 +00:00
|
|
|
-Ithird_party/externals/icu/source/common/ \
|
2018-10-25 18:46:50 +00:00
|
|
|
-DSK_DISABLE_AAA \
|
2020-01-28 15:39:56 +00:00
|
|
|
-DSK_FORCE_8_BYTE_ALIGNMENT \
|
2020-10-08 19:58:12 +00:00
|
|
|
-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
|
|
|
|
-fno-rtti \
|
2018-10-11 12:51:55 +00:00
|
|
|
$WASM_GPU \
|
2020-01-06 13:10:05 +00:00
|
|
|
$WASM_PATHOPS \
|
2020-01-06 13:11:52 +00:00
|
|
|
$WASM_RT_SHADER \
|
2020-01-14 13:39:09 +00:00
|
|
|
$WASM_SKP \
|
2019-09-26 17:20:50 +00:00
|
|
|
$FONT_CFLAGS \
|
2020-01-28 15:39:56 +00:00
|
|
|
-std=c++17 \
|
2018-09-20 21:39:31 +00:00
|
|
|
--bind \
|
2020-05-21 13:59:44 +00:00
|
|
|
--no-entry \
|
2019-02-28 15:06:18 +00:00
|
|
|
--pre-js $BASE_DIR/preamble.js \
|
2021-01-21 16:41:01 +00:00
|
|
|
--pre-js $BASE_DIR/color.js \
|
|
|
|
--pre-js $BASE_DIR/memory.js \
|
|
|
|
--pre-js $BASE_DIR/util.js \
|
2018-09-20 21:39:31 +00:00
|
|
|
--pre-js $BASE_DIR/interface.js \
|
2021-01-29 13:37:41 +00:00
|
|
|
$MATRIX_HELPER_JS \
|
2019-10-03 15:22:08 +00:00
|
|
|
$PARAGRAPH_JS \
|
2019-02-28 15:06:18 +00:00
|
|
|
$SKOTTIE_JS \
|
2019-11-27 15:34:18 +00:00
|
|
|
$PARTICLES_JS \
|
2020-01-06 13:10:05 +00:00
|
|
|
$PATHOPS_JS \
|
|
|
|
$FONT_JS \
|
|
|
|
$SKP_JS \
|
2020-01-06 13:11:52 +00:00
|
|
|
$RT_SHADER_JS \
|
2018-10-19 18:34:34 +00:00
|
|
|
$HTML_CANVAS_API \
|
2019-02-28 15:06:18 +00:00
|
|
|
--pre-js $BASE_DIR/postamble.js \
|
2018-10-02 15:33:52 +00:00
|
|
|
$BASE_DIR/canvaskit_bindings.cpp \
|
2019-03-06 14:32:55 +00:00
|
|
|
$PARTICLES_BINDINGS \
|
2019-02-22 15:04:06 +00:00
|
|
|
$SKOTTIE_BINDINGS \
|
2020-03-25 16:50:35 +00:00
|
|
|
$VIEWER_BINDINGS \
|
2019-02-22 15:04:06 +00:00
|
|
|
$MANAGED_SKOTTIE_BINDINGS \
|
2019-10-03 15:22:08 +00:00
|
|
|
$PARAGRAPH_BINDINGS \
|
2019-02-22 15:04:06 +00:00
|
|
|
$SKOTTIE_LIB \
|
2020-03-25 16:50:35 +00:00
|
|
|
$VIEWER_LIB \
|
2019-03-06 14:32:55 +00:00
|
|
|
$PARTICLES_LIB \
|
2019-10-03 15:22:08 +00:00
|
|
|
$PARAGRAPH_LIB \
|
2019-02-22 15:04:06 +00:00
|
|
|
$BUILD_DIR/libskshaper.a \
|
|
|
|
$SHAPER_LIB \
|
2019-03-07 16:48:56 +00:00
|
|
|
$BUILD_DIR/libskia.a \
|
2019-10-03 18:18:23 +00:00
|
|
|
$BUILTIN_FONT \
|
2020-08-20 14:47:34 +00:00
|
|
|
-s LLD_REPORT_UNDEFINED \
|
2018-09-20 21:39:31 +00:00
|
|
|
-s ALLOW_MEMORY_GROWTH=1 \
|
|
|
|
-s EXPORT_NAME="CanvasKitInit" \
|
2020-10-08 15:39:56 +00:00
|
|
|
-s EXPORTED_FUNCTIONS=['_malloc','_free'] \
|
2018-09-20 21:39:31 +00:00
|
|
|
-s FORCE_FILESYSTEM=0 \
|
2020-01-02 13:16:51 +00:00
|
|
|
-s FILESYSTEM=0 \
|
2018-09-20 21:39:31 +00:00
|
|
|
-s MODULARIZE=1 \
|
|
|
|
-s NO_EXIT_RUNTIME=1 \
|
2020-05-21 13:59:44 +00:00
|
|
|
-s INITIAL_MEMORY=128MB \
|
2018-09-20 21:39:31 +00:00
|
|
|
-s WASM=1 \
|
2020-09-18 19:27:35 +00:00
|
|
|
$STRICTNESS \
|
2018-10-09 13:36:35 +00:00
|
|
|
-o $BUILD_DIR/canvaskit.js
|