generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 49
/
BUILD
88 lines (72 loc) · 2.68 KB
/
BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Added BUILD file in the kubernetes c client repository helps integrating the library to external Bazel users.
# Following are the changes required from the external Bazel users to do.
# WORKSPACE
# load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# http_archive(
# name = "rules_foreign_cc",
# sha256 = "a2e6fb56e649c1ee79703e99aa0c9d13c6cc53c8d7a0cbb8797ab2888bbc99a3",
# strip_prefix = "rules_foreign_cc-0.12.0",
# url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.12.0/rules_foreign_cc-0.12.0.tar.gz",
# )
# load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
# # This sets up some common toolchains for building targets. For more details, please see
# # https://bazelbuild.github.io/rules_foreign_cc/0.12.0/flatten.html#rules_foreign_cc_dependencies
# rules_foreign_cc_dependencies()
# load("@bazel_features//:deps.bzl", "bazel_features_deps")
# bazel_features_deps()
# http_archive(
# name = "kubernetes_c_client",
# sha256 = "10d0c5af1a52a1d2da379e8e45b53978b9dedc90ff195bdff171ae17c1f1dd50",
# strip_prefix = "c-0.11.0",
# url = "https://github.com/kubernetes-client/c/archive/refs/tags/v0.11.0.zip",
# )
# BUILD file:
# load("@rules_cc//cc:defs.bzl", "cc_binary")
# load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
# load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
# cmake(
# name = "kube_c",
# build_args = [
# "--verbose",
# "--", # <- Pass remaining options to the native tool.
# "-j 1",
# ],
# lib_source = "@kubernetes_c_client//:kubernetes",
# out_shared_libs = ["libkubernetes.so"],
# )
# cc_binary(
# name = "create_pod",
# srcs = ["create_pod.c"],
# deps = [":kube_c"],
# )
# cc_binary(
# name = "list_pod",
# srcs = ["list_pod.c"],
# deps = [":kube_c"],
# )
# Make sure you install the pre-requisites (libyaml,libwebsocket etc.) beforehand. A working example can be found in the example directory.
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake", "make")
filegroup(
name = "kubernetes",
srcs = glob(["kubernetes/**"]),
visibility = ["//visibility:public"],
)
cmake(
name = "kube_c",
build_args = [
"--verbose",
"--", # <- Pass remaining options to the native tool.
"-j 1",
],
lib_source = ":kubernetes",
out_shared_libs = ["libkubernetes.so"],
)
# create lib files (.so or .a)
cc_library(
name = "kube_c_library",
hdrs = [":kubernetes"], # Explicitly add headers if needed
strip_include_prefix = "kubernetes",
visibility = ["//visibility:public"],
deps = [":kube_c"],
)