• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2025 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/toolchain/gcc_toolchain.gni")
6
7# This WASM toolchain is NOT to be used to build any Chromium code,
8# i.e. tests and samples are currently fine.
9# Usage of this toolchain requires getting explicit approval from
10# build/OWNERS.
11gcc_toolchain("wasm") {
12  emscripten_path = "//third_party/emsdk/upstream/emscripten/"
13  _suffix = ""
14  if (host_os == "win") {
15    _suffix = ".bat"
16  }
17
18  cc = rebase_path("$emscripten_path/emcc$_suffix", root_build_dir)
19  cxx = rebase_path("$emscripten_path/em++$_suffix", root_build_dir)
20  ar = rebase_path("$emscripten_path/emar$_suffix", root_build_dir)
21  nm = cc
22  ld = cxx
23
24  toolchain_args = {
25    current_cpu = "wasm"
26    current_os = "emscripten"
27
28    is_clang = true
29    use_remoteexec = false
30    use_debug_fission = false
31    clang_use_chrome_plugins = false
32    use_allocator_shim = false
33    is_component_build = false
34
35    # We do not support clang profiling in the WASM toolchains.
36    use_clang_profiling = false
37    use_clang_coverage = false
38
39    # WASM builds cannot currently use the custom libc++ because
40    # there are custom entry points and defines in the one that is
41    # shipped with emsdk.
42    use_custom_libcxx = false
43    use_custom_libcxx_for_host = false
44  }
45  executable_extension = ".html"
46  link_outputs = [
47    "{{output_dir}}/{{target_output_name}}.wasm",
48    "{{output_dir}}/{{target_output_name}}.wasm.debug.wasm",
49  ]
50}
51