# Copyright 2014 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.

# Deletes libsystem.dylib from the build dir, since it shadows
# /usr/lib/libSystem.dylib on macOS.
# TODO(thakis): Remove this after a while.
action("clean_up_old_dylib") {
  script = "//build/rm.py"
  stamp = "$target_gen_dir/clean_up_stamp"
  outputs = [
    stamp,
  ]
  args = [
    "--stamp",
    rebase_path(stamp, root_build_dir),
    "-f",
    "libsystem.dylib",
  ]
}

component("system") {
  output_name = "mojo_public_system_cpp"

  sources = [
    "buffer.cc",
    "buffer.h",
    "core.h",
    "data_pipe.h",
    "file_data_pipe_producer.cc",
    "file_data_pipe_producer.g",
    "functions.h",
    "handle.h",
    "handle_signal_tracker.cc",
    "handle_signal_tracker.h",
    "handle_signals_state.h",
    "message.h",
    "message_pipe.cc",
    "message_pipe.h",
    "platform_handle.cc",
    "platform_handle.h",
    "simple_watcher.cc",
    "simple_watcher.h",
    "string_data_pipe_producer.cc",
    "string_data_pipe_producer.h",
    "system_export.h",
    "wait.cc",
    "wait.h",
    "wait_set.cc",
    "wait_set.h",
    "watcher.cc",
    "watcher.h",
  ]

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

  defines = [ "MOJO_CPP_SYSTEM_IMPLEMENTATION" ]
}