blob: b7bb957b1eff49320dfee55c1e93e951e1dd7847 [file] [log] [blame]
# 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.
import("../../modules/canvaskit/canvaskit.gni")
# Defines the configuration of emscripten for building WASM targets.
import("../skia.gni")
declare_args() {
# The location of an activated emsdk. We default to the one brought in by
# DEPS and bin/activate-emsdk.
skia_emsdk_dir = rebase_path("../../third_party/externals/emsdk")
}
# Defines a WASM library target.
template("skia_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 = "js"
output_name = "${_lib_name}"
}
group("$_lib_name") {
public_deps = [ ":${_lib_name}_js" ]
}
}
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" ]
}