chromium/native_client_sdk/src/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/toolchain/toolchain.gni")
import("//components/nacl/features.gni")

declare_args() {
  # Set to true if cross compiling trusted (e.g. building sel_ldr_arm on x86)
  # binaries is supported.
  enable_cross_trusted = is_linux || is_chromeos

  # Build the nacl SDK untrusted components.  This is disabled by default since
  # not all NaCl untrusted compilers are in RBE (e.g arm-nacl-glibc)
  nacl_sdk_untrusted = false
}

if (enable_nacl) {
  group("nacl_core_sdk") {
    # Targets that get included in the NaCl SDK
    # See: native_client_sdk/src/build_tools/build_sdk.py
    deps = []
    if (enable_cross_trusted ||
        (target_cpu != "arm" && target_cpu != "mipsel")) {
      # cross compiling trusted binaries such as sel_ldr is only currently
      # supported on linux, and requires specific cross compilers to be
      # installed. It can be disabled with 'disable_cross_trusted=1'
      deps = [
        "//native_client/src/trusted/service_runtime:sel_ldr",
        "//native_client/src/trusted/validator/driver:ncval_new",
      ]
    }
    if (nacl_sdk_untrusted) {
      deps += [
        # elf_loader is only used on ARM
        "//native_client/src/untrusted/elf_loader:elf_loader(//build/toolchain/nacl:clang_newlib_arm)",
        "//native_client/src/untrusted/irt:irt_core(//build/toolchain/nacl:irt_arm)",
        "//native_client/src/untrusted/irt:irt_core(//build/toolchain/nacl:irt_x64)",
        "//native_client/src/untrusted/irt:irt_core(//build/toolchain/nacl:irt_x86)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:clang_newlib_arm)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:clang_newlib_x64)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:clang_newlib_x86)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:glibc_arm)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:glibc_x64)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:glibc_x86)",
        "//ppapi/native_client:ppapi_lib(//build/toolchain/nacl:newlib_pnacl)",
        "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_arm)",
        "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_x64)",
        "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_x86)",
      ]
    }

    # TODO(binji): dump_syms doesn't currently build on Windows. See
    # http://crbug.com/245456
    if (!is_win && target_cpu == "x64") {
      deps += [
        "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)",
        "//third_party/breakpad:minidump_dump($host_system_allocator_toolchain)",
        "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)",
      ]
    }
  }
}