# Copyright 2018 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("//build/config/nacl/config.gni")

component("platform") {
  output_name = "mojo_cpp_platform"

  public = [
    "named_platform_channel.h",
    "platform_channel.h",
    "platform_channel_endpoint.h",
    "platform_channel_server_endpoint.h",
    "platform_handle.h",
  ]

  sources = [
    "named_platform_channel.cc",
    "named_platform_channel_win.cc",
    "platform_channel.cc",
    "platform_channel_endpoint.cc",
    "platform_channel_server_endpoint.cc",
    "platform_handle.cc",
  ]

  if (is_posix && (!is_nacl || is_nacl_nonsfi)) {
    public += [ "socket_utils_posix.h" ]
    sources += [ "socket_utils_posix.cc" ]
  }

  public_deps = [
    "//base",
    "//mojo/public/c/system:headers",
  ]

  if (is_posix && (!is_nacl && !is_fuchsia)) {
    sources += [ "named_platform_channel_posix.cc" ]
  }

  if (is_fuchsia) {
    sources += [ "named_platform_channel_fuchsia.cc" ]
    public_deps += [
      "//third_party/fuchsia-sdk:fdio",
      "//third_party/fuchsia-sdk:zx",
    ]
  }

  defines = [ "IS_MOJO_CPP_PLATFORM_IMPL" ]
}