• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_import", "cc_library", "cc_test")
2
3package(default_visibility = ["//ffi/rust_calling_c:__subpackages__"])
4
5cc_library(
6    name = "native_matrix",
7    srcs = ["matrix.c"],
8    hdrs = ["matrix.h"],
9    copts = ["-std=c99"],
10)
11
12cc_test(
13    name = "native_matrix_test",
14    srcs = ["matrix_test.c"],
15    copts = ["-std=c99"],
16    linkstatic = 1,
17    deps = [
18        ":native_matrix",
19    ],
20)
21
22## Do the same as above, but with a dynamic c library.
23
24cc_import(
25    name = "native_matrix_so",
26    hdrs = ["matrix.h"],
27    shared_library = ":libnative_matrix_so.so",
28)
29
30cc_binary(
31    name = "libnative_matrix_so.so",
32    srcs = [
33        "matrix.c",
34        "matrix.h",
35    ],
36    copts = ["-std=c99"],
37    linkshared = True,
38)
39