skia2/gn/toolchain/wasm.gni
Harry Terkelsen ecac712bec Build CanvasKit using GN/Ninja
Build with

./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'

or

./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'

Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-11 13:05:44 +00:00

67 lines
1.5 KiB
Plaintext

# Copyright (c) 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Defines the configuration of emscripten for building WASM targets.
import("//gn/skia.gni")
import("//modules/canvaskit/canvaskit.gni")
declare_args() {
# The location of an activated embedded emsdk.
emsdk_dir = rebase_path("//third_party/externals/emsdk")
}
wasm_toolchain = "//gn/toolchain:wasm"
is_wasm = target_os == "wasm"
em_config_path = "$emsdk_dir/.emscripten"
# Defines a WASM library target.
template("wasm_lib") {
_vars_to_forward = [
"cflags",
"ldflags",
"defines",
"deps",
"includes",
"sources",
"include_dirs",
"public_configs",
"testonly",
"visibility",
]
_lib_name = target_name
executable("${_lib_name}.js") {
forward_variables_from(invoker, _vars_to_forward)
output_extension = ""
}
group("$_lib_name") {
deps = [ ":${_lib_name}.js($wasm_toolchain)" ]
}
}
wasm_defines = [
"SKNX_NO_SIMD",
"SK_DISABLE_AAA",
"SK_FORCE_8_BYTE_ALIGNMENT",
]
if (!is_debug && !skia_canvaskit_force_tracing) {
wasm_defines += [ "SK_DISABLE_TRACING" ]
}
if (skia_enable_gpu) {
wasm_defines += [ "SK_DISABLE_LEGACY_SHADERCONTEXT" ]
}
if (!skia_canvaskit_enable_effects_deserialization ||
!skia_canvaskit_enable_skp_serialization) {
wasm_defines += [ "SK_DISABLE_EFFECT_DESERIALIZATION" ]
}
if (!skia_canvaskit_enable_alias_font) {
wasm_defines += [ "CANVASKIT_NO_ALIAS_FONT" ]
}