/*
 *  Copyright (c) 2025 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.
 */

genrule {
    name: "cs_config_proto_headers",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "cs_config.proto",
    ],
    out: [
        "cs_config.pb.h",
    ],
}

genrule {
    name: "cs_config_proto_sources",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "cs_config.proto",
    ],
    out: [
        "cs_config.pb.cc",
    ],
}

genrule {
    name: "hal_config_proto_headers",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "hal_config.proto",
    ],
    out: [
        "hal_config.pb.h",
    ],
}

genrule {
    name: "hal_config_proto_sources",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "hal_config.proto",
    ],
    out: [
        "hal_config.pb.cc",
    ],
}

genrule {
    name: "firmware_config_proto_headers",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "firmware_config.proto",
    ],
    out: [
        "firmware_config.pb.h",
    ],
}

genrule {
    name: "firmware_config_proto_sources",
    tools: [
        "aprotoc",
    ],
    cmd: "$(location aprotoc) --proto_path=hardware/interfaces/bluetooth/bluetooth_hal/config/proto $(in) --cpp_out=$(genDir)",
    srcs: [
        "firmware_config.proto",
    ],
    out: [
        "firmware_config.pb.cc",
    ],
}

cc_library_static {
    name: "hal_proto_lib",
    host_supported: true,
    include_dirs: [
        "external/protobuf/src",
    ],
    generated_headers: [
        "cs_config_proto_headers",
        "hal_config_proto_headers",
        "firmware_config_proto_headers",
    ],
    export_generated_headers: [
        "cs_config_proto_headers",
        "hal_config_proto_headers",
        "firmware_config_proto_headers",
    ],
    generated_sources: [
        "cs_config_proto_sources",
        "hal_config_proto_sources",
        "firmware_config_proto_sources",
    ],
    shared_libs: [
        "libprotobuf-cpp-full",
    ],
    cflags: [
        "-Wall",
        "-Werror",
        "-Wno-unused-parameter",
    ],
    vendor_available: true,
}
