# 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" ] }