load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:copts.bzl", "COPTS")

cc_library(
    name = "shardok-server-lib",
    srcs = ["shardok_server_main.cpp"],
    copts = COPTS,
    data = [
        "//src/main/resources/net/eagle0/shardok:battalion_types",
        "//src/main/resources/net/eagle0/shardok:settings",
        "//src/main/resources/net/eagle0/shardok/maps",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/main/cpp/net/eagle0/shardok/library:engine",
        "//src/main/cpp/net/eagle0/shardok/server:eagle_interface_grpc_server",
        "//src/main/cpp/net/eagle0/shardok/server:server_configuration",
        "//src/main/cpp/net/eagle0/shardok/server:token_auth",
        "//src/main/protobuf/net/eagle0/common:common_unit_cc_proto",
        "@grpc//:grpc++",
    ],
)

cc_binary(
    name = "shardok-server",
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [":shardok-server-lib"],
)

cc_binary(
    name = "hex-map-migrator",
    srcs = ["HexMapMigrator.cpp"],
    copts = COPTS,
    deps = [
        "//src/main/cpp/net/eagle0/common:byte_vector",
        "//src/main/cpp/net/eagle0/common:filesystem_utils",
        "//src/main/protobuf/net/eagle0/shardok/common:hex_map_cc_proto",
    ],
)

cc_binary(
    name = "random_battle_runner",
    srcs = ["RandomBattleRunner.cpp"],
    copts = COPTS,
    data = [
        "//src/main/resources/net/eagle0/shardok:battalion_types",
        "//src/main/resources/net/eagle0/shardok:settings",
        "//src/main/resources/net/eagle0/shardok/maps",
    ],
    deps = [
        "//src/main/cpp/net/eagle0/common:byte_vector",
        "//src/main/cpp/net/eagle0/common:filesystem_utils",
        "//src/main/cpp/net/eagle0/common:unit_conversions",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/server:games_manager",
        "//src/main/protobuf/net/eagle0/common:random_units_cc_proto",
    ],
)

cc_library(
    name = "map_info_calculator",
    srcs = ["MapInfoCalculator.cpp"],
    hdrs = ["MapInfoCalculator.hpp"],
    copts = COPTS,
    data = [
        "//src/main/resources/net/eagle0/shardok:battalion_types",
        "//src/main/resources/net/eagle0/shardok:settings",
        "//src/main/resources/net/eagle0/shardok/maps",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//src/main/cpp/net/eagle0/shardok/ai:ai_water_crossing_calculator",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/library/fb_helpers:hex_map_helpers",
        "//src/main/cpp/net/eagle0/shardok/util:battalion_type_registrar",
        "//src/main/cpp/net/eagle0/shardok/util:map_loader",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:hex_map_cc_fbs",
    ],
)

cc_binary(
    name = "map_info_calculator_runner",
    srcs = ["MapInfoCalculatorRunner.cpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [":map_info_calculator"],
)
