load("@bazel_lib//lib:expand_template.bzl", "expand_template") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_shared_library.bzl", "cc_shared_library") load("@rules_cc//cc:cc_test.bzl", "cc_test") expand_template( name = "gen_config_types", out = "include/ogg/config_types.h", template = "include/ogg/config_types.h.in", substitutions = { "@INCLUDE_INTTYPES_H@": "1", "@INCLUDE_STDINT_H@": "1", "@INCLUDE_SYS_TYPES_H@": "1", "@SIZE16@": "int16_t", "@USIZE16@": "uint16_t", "@SIZE32@": "int32_t", "@USIZE32@": "uint32_t", "@SIZE64@": "int64_t", "@USIZE64@": "uint64_t", }, ) cc_library( name = "hdrs", hdrs = glob(["include/ogg/*.h"]) + ["include/ogg/config_types.h"], includes = ["include"], ) cc_library( name = "libogg", srcs = [ "src/bitwise.c", "src/framing.c", ], textual_hdrs = ["src/crctable.h"], deps = [":hdrs"], ) cc_shared_library( name = "ogg", deps = [":libogg"], visibility = ["//visibility:public"], ) cc_test( name = "bitwise_test", srcs = ["src/bitwise.c"], defines = ["_V_SELFTEST"], deps = [":hdrs"], ) cc_test( name = "framing_test", srcs = ["src/crctable.h", "src/framing.c"], defines = ["_V_SELFTEST"], deps = [":hdrs"], )