//
// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

cc_binary_host {
    name: "run_cvd",
    srcs: [
        "boot_state_machine.cc",
        "launch/automotive_proxy.cpp",
        "launch/bluetooth_connector.cpp",
        "launch/nfc_connector.cpp",
        "launch/uwb_connector.cpp",
        "launch/casimir_control_server.cpp",
        "launch/console_forwarder.cpp",
        "launch/control_env_proxy_server.cpp",
        "launch/gnss_grpc_proxy.cpp",
        "launch/kernel_log_monitor.cpp",
        "launch/logcat_receiver.cpp",
        "launch/log_tee_creator.cpp",
        "launch/grpc_socket_creator.cpp",
        "launch/metrics.cpp",
        "launch/openwrt_control_server.cpp",
        "launch/echo_server.cpp",
        "launch/root_canal.cpp",
        "launch/casimir.cpp",
        "launch/pica.cpp",
        "launch/screen_recording_server.cpp",
        "launch/secure_env.cpp",
        "launch/snapshot_control_files.cpp",
        "launch/webrtc_recorder.cpp",
        "launch/streamer.cpp",
        "launch/netsim_server.cpp",
        "launch/vhal_proxy_server.cpp",
        "main.cc",
        "reporting.cpp",
        "server_loop.cpp",
        "server_loop_impl.cpp",
        "server_loop_impl_record.cpp",
        "server_loop_impl_snapshot.cpp",
        "validate.cpp",
    ],
    shared_libs: [
        "libbase",
        "libcuttlefish_fs",
        "libcuttlefish_kernel_log_monitor_utils",
        "libcuttlefish_run_cvd_proto",
        "libcuttlefish_utils",
        "libext2_blkid",
        "libfruit",
        "libjsoncpp",
        "libprotobuf-cpp-full",
    ],
    static_libs: [
        "libbuildversion",
        "libcuttlefish_command_util",
        "libcuttlefish_host_config",
        "libcuttlefish_host_config_adb",
        "libcuttlefish_host_config_fastboot",
        "libcuttlefish_metrics",
        "libcuttlefish_msg_queue",
        "libcuttlefish_process_monitor",
        "libcuttlefish_utils",
        "libcuttlefish_vm_manager",
        "libgflags",
    ],
    required: [
        "console_forwarder",
        "kernel_log_monitor",
        "logcat_receiver",
        "log_tee",
        "secure_env",
        "tcp_connector",
    ],
    target: {
        darwin: {
            enabled: true,
        },
        linux: {
            required: [
                "echo_server",
                "gnss_grpc_proxy",
            ],
            srcs: [
                "launch/mcu.cpp",
                "launch/modem.cpp",
                "launch/open_wrt.cpp",
                "launch/tombstone_receiver.cpp",
                "launch/vhost_device_vsock.cpp",
                "launch/wmediumd_server.cpp",
            ],
            shared_libs: [
                "libnl",
            ],
        },
    },
    defaults: [
        "cuttlefish_host",
        "cvd_cc_defaults",
    ],
    use_version_lib: true,
}