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
|
genrule(
name = "cbor_cmake",
srcs = glob(["**"]),
outs = [
"libcbor.a",
"cbor.h",
"cbor/arrays.h",
"cbor/bytestrings.h",
"cbor/callbacks.h",
"cbor/cbor_export.h",
"cbor/common.h",
"cbor/configuration.h",
"cbor/data.h",
"cbor/encoding.h",
"cbor/floats_ctrls.h",
"cbor/ints.h",
"cbor/maps.h",
"cbor/serialization.h",
"cbor/streaming.h",
"cbor/strings.h",
"cbor/tags.h",
],
cmd = " && ".join([
# Remember where output should go.
"INITIAL_WD=`pwd`",
"cd `dirname $(location CMakeLists.txt)`",
"cmake -DCMAKE_BUILD_TYPE=Release .",
"cmake --build .",
# Export the .a and .h files for cbor rule, below.
"cp -R src/* $$INITIAL_WD/$(RULEDIR)",
"cp cbor/configuration.h $$INITIAL_WD/$(RULEDIR)/cbor",
]),
visibility = ["//visibility:private"],
)
cc_import(
name = "cbor",
hdrs = [
"cbor.h",
"cbor/arrays.h",
"cbor/bytestrings.h",
"cbor/callbacks.h",
"cbor/cbor_export.h",
"cbor/common.h",
"cbor/configuration.h",
"cbor/data.h",
"cbor/encoding.h",
"cbor/floats_ctrls.h",
"cbor/ints.h",
"cbor/maps.h",
"cbor/serialization.h",
"cbor/streaming.h",
"cbor/strings.h",
"cbor/tags.h",
],
static_library = "libcbor.a",
visibility = ["//visibility:public"],
)
|