chromium/ppapi/shared_impl/BUILD.gn

# Copyright 2015 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/config/nacl/config.gni")
import("//components/nacl/toolchain.gni")
import("//ppapi/buildflags/buildflags.gni")

assert(enable_ppapi)

# //ppapi/shared_impl and //ppapi/thunk go into the same library.
config("export_shared_impl_and_thunk") {
  visibility = [
    ":*",
    "//ppapi/thunk:*",
  ]
  defines = [
    "PPAPI_SHARED_IMPLEMENTATION",
    "PPAPI_THUNK_IMPLEMENTATION",
  ]
}

source_set("headers") {
  visibility = [
    ":*",
    "//ppapi/thunk:*",
  ]

  sources = [
    "host_resource.h",
    "ppapi_globals.h",
    "proxy_lock.h",
    "resource.h",
  ]

  configs += [ ":export_shared_impl_and_thunk" ]

  deps = [
    "//base",
    "//ppapi/c/",
  ]
}

# This contains the things that //ppapi/thunk needs.
source_set("common") {
  visibility = [
    ":*",
    "//ppapi/thunk:*",
  ]

  sources = [
    "array_var.cc",
    "array_var.h",
    "callback_tracker.cc",
    "callback_tracker.h",
    "dictionary_var.cc",
    "dictionary_var.h",
    "file_ref_create_info.cc",
    "file_ref_create_info.h",
    "host_resource.cc",
    "id_assignment.cc",
    "id_assignment.h",
    "ppapi_globals.cc",
    "ppb_audio_config_shared.cc",
    "ppb_audio_config_shared.h",
    "ppb_device_ref_shared.cc",
    "ppb_device_ref_shared.h",
    "ppb_image_data_shared.cc",
    "ppb_image_data_shared.h",
    "ppb_message_loop_shared.cc",
    "ppb_message_loop_shared.h",
    "proxy_lock.cc",
    "resource.cc",
    "resource_tracker.cc",
    "resource_tracker.h",
    "resource_var.cc",
    "resource_var.h",
    "scoped_pp_var.cc",
    "scoped_pp_var.h",
    "tracked_callback.cc",
    "tracked_callback.h",
    "url_response_info_data.cc",
    "url_response_info_data.h",
    "var.cc",
    "var.h",
    "var_tracker.cc",
    "var_tracker.h",
  ]

  if (!is_nacl) {
    sources += [
      "ppb_url_util_shared.cc",
      "ppb_url_util_shared.h",
      "private/ppb_char_set_shared.cc",
      "private/ppb_char_set_shared.h",
    ]
  }

  configs += [ ":export_shared_impl_and_thunk" ]

  public_deps = [ ":headers" ]

  deps = [
    "//base",
    "//base:i18n",
    "//build:chromeos_buildflags",
    "//components/nacl/common:buildflags",
    "//ppapi/c",
    "//ppapi/thunk:headers",
    "//third_party/icu:icuuc",
    "//url",
  ]

  if (!is_nacl && !is_minimal_toolchain) {
    deps += [ "//skia" ]
  }
}

component("shared_impl") {
  output_name = "ppapi_shared"

  sources = [
    "array_writer.cc",
    "array_writer.h",
    "file_growth.cc",
    "file_growth.h",
    "file_io_state_manager.cc",
    "file_io_state_manager.h",
    "file_path.cc",
    "file_path.h",
    "file_ref_util.cc",
    "file_ref_util.h",
    "file_system_util.cc",
    "file_system_util.h",
    "file_type_conversion.cc",
    "file_type_conversion.h",
    "media_stream_audio_track_shared.cc",
    "media_stream_audio_track_shared.h",
    "media_stream_buffer.h",
    "media_stream_buffer_manager.cc",
    "media_stream_buffer_manager.h",
    "media_stream_video_track_shared.cc",
    "media_stream_video_track_shared.h",
    "platform_file.cc",
    "platform_file.h",
    "ppapi_nacl_plugin_args.cc",
    "ppapi_nacl_plugin_args.h",
    "ppapi_permissions.cc",
    "ppapi_permissions.h",
    "ppapi_preferences.cc",
    "ppapi_preferences.h",
    "ppapi_switches.cc",
    "ppapi_switches.h",
    "ppb_audio_shared.cc",
    "ppb_audio_shared.h",
    "ppb_crypto_shared.cc",
    "ppb_gamepad_shared.cc",
    "ppb_gamepad_shared.h",
    "ppb_graphics_3d_shared.cc",
    "ppb_graphics_3d_shared.h",
    "ppb_input_event_shared.cc",
    "ppb_input_event_shared.h",
    "ppb_instance_shared.cc",
    "ppb_instance_shared.h",
    "ppb_memory_shared.cc",
    "ppb_opengles2_shared.cc",
    "ppb_opengles2_shared.h",
    "ppb_tcp_socket_shared.cc",
    "ppb_tcp_socket_shared.h",
    "ppb_trace_event_impl.cc",
    "ppb_trace_event_impl.h",
    "ppb_var_shared.cc",
    "ppb_var_shared.h",
    "ppb_view_shared.cc",
    "ppb_view_shared.h",
    "ppp_instance_combined.cc",
    "ppp_instance_combined.h",
    "scoped_pp_resource.cc",
    "scoped_pp_resource.h",
    "socket_option_data.cc",
    "socket_option_data.h",
    "thread_aware_callback.cc",
    "thread_aware_callback.h",
    "time_conversion.cc",
    "time_conversion.h",
    "url_request_info_data.cc",
    "url_request_info_data.h",
    "vpn_provider_util.cc",
    "vpn_provider_util.h",

    # TODO(viettrungluu): Split these out; it won"t be used in NaCl.
    "private/net_address_private_impl.cc",
    "private/net_address_private_impl.h",
    "private/net_address_private_impl_constants.cc",
    "private/ppb_x509_certificate_private_shared.cc",
    "private/ppb_x509_certificate_private_shared.h",
  ]

  # This condition is catching the build of nacl64.exe, which is built
  # in the 64-bit toolchain when the overall build is 32-bit.
  # See also //ppapi/thunk
  if (is_win && target_cpu == "x86" && current_cpu == "x64") {
    sources -= [
      "ppb_audio_shared.cc",
      "ppb_graphics_3d_shared.cc",
      "ppb_opengles2_shared.cc",
      "private/net_address_private_impl.cc",
    ]
  }

  configs += [
    ":export_shared_impl_and_thunk",
    "//build/config:precompiled_headers",
  ]

  public_deps = [
    ":common",
    "//base",
    "//ppapi/c",
    "//ppapi/thunk",
  ]

  deps = [
    "//build:chromeos_buildflags",
    "//components/nacl/common:buildflags",
    "//device/gamepad/public/cpp:shared_with_blink",
    "//gpu/command_buffer/client",
    "//gpu/command_buffer/client:gles2_cmd_helper",
    "//gpu/command_buffer/client:gles2_implementation",
    "//gpu/command_buffer/common",
    "//ipc",
    "//media:shared_memory_support",
    "//ui/gfx:gfx_switches",
  ]

  if (!is_nacl && !is_minimal_toolchain) {
    sources += [
      "ppb_video_decoder_shared.cc",
      "ppb_video_decoder_shared.h",
      "private/ppb_x509_util_shared.cc",
      "private/ppb_x509_util_shared.h",
    ]

    deps += [
      "//net",
      "//ui/events:events_base",
      "//ui/surface",
    ]
  }

  if (is_mac) {
    frameworks = [ "QuartzCore.framework" ]
  }
}

static_library("test_support") {
  testonly = true

  sources = [
    "test_globals.cc",
    "test_globals.h",
    "test_utils.cc",
    "test_utils.h",
  ]

  public_deps = [ "//ppapi/shared_impl" ]
  deps = [
    "//base/test:test_support",
    "//ipc",
    "//ipc:test_support",
    "//ppapi/proxy",
    "//testing/gmock",
    "//testing/gtest",
  ]
}