cxx_binary(
    name = "zstd",
    srcs = glob(
        ["*.c"],
        excludes = ["datagen.c"],
    ),
    headers = glob(
        ["*.h"],
        excludes = [
            "datagen.h",
            "platform.h",
            "util.h",
        ],
    ),
    linker_flags = [
        "-lz",
        "-llzma",
        "-llz4",
    ],
    preprocessor_flags = [
        "-DZSTD_GZCOMPRESS",
        "-DZSTD_GZDECOMPRESS",
        "-DZSTD_LZMACOMPRESS",
        "-DZSTD_LZMADECOMPRES",
        "-DZSTD_LZ4COMPRESS",
        "-DZSTD_LZ4DECOMPRES",
    ],
    deps = [
        ":datagen",
        ":util",
        "//lib:mem",
        "//lib:xxhash",
        "//lib:zdict",
        "//lib:zstd",
    ],
)

cxx_library(
    name = "datagen",
    srcs = ["datagen.c"],
    exported_headers = ["datagen.h"],
    header_namespace = "",
    visibility = ["PUBLIC"],
    deps = ["//lib:mem"],
)

cxx_library(
    name = "util",
    exported_headers = [
        "util.h",
        "platform.h",
    ],
    header_namespace = "",
    visibility = ["PUBLIC"],
    deps = ["//lib:mem"],
)
