forked from gazebosim/gz-msgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
140 lines (124 loc) · 2.83 KB
/
BUILD.bazel
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
load(
"@gz//bazel/skylark:build_defs.bzl",
"GZ_FEATURES",
"GZ_ROOT",
"GZ_VISIBILITY",
"gz_configure_header",
"gz_export_header",
"gz_include_header",
)
load(
"@gz//msgs/tools:gz_msgs_generate.bzl",
"get_proto_headers",
"gz_msgs_generate",
)
package(
default_visibility = GZ_VISIBILITY,
features = GZ_FEATURES,
)
licenses(["notice"]) # Apache-2.0
exports_files(["LICENSE"])
gz_configure_header(
name = "msgs_config_hh",
src = "include/gz/msgs/config.hh.in",
cmakelists = ["CMakeLists.txt"],
package = "msgs",
)
gz_export_header(
name = "include/gz/msgs/Export.hh",
export_base = "GZ_MSGS",
lib_name = "gz-msgs",
visibility = ["//visibility:private"],
)
public_headers_no_gen = glob([
"include/gz/msgs/*.hh",
"include/gz/msgs/detail/*.hh",
])
protos = glob(["proto/gz/msgs/*.proto"])
gz_include_header(
name = "messagetypes_hh_genrule",
out = "include/gz/msgs/MessageTypes.hh",
hdrs = get_proto_headers(protos),
strip_prefix = ["gz_msgs"],
)
gz_include_header(
name = "msgs_hh_genrule",
out = "include/gz/msgs.hh",
hdrs = public_headers_no_gen + [
"include/gz/msgs/config.hh",
"include/gz/msgs/Export.hh",
"include/gz/msgs/MessageTypes.hh",
],
)
public_headers = public_headers_no_gen + [
"include/gz/msgs/config.hh",
"include/gz/msgs/Export.hh",
"include/gz/msgs/MessageTypes.hh",
"include/gz/msgs.hh",
]
# Custom Gazebo Protoc plugin
cc_binary(
name = "gz_msgs_gen",
srcs = [
"src/Generator.cc",
"src/Generator.hh",
"src/generator_main.cc",
],
deps = [
"@com_google_protobuf//:protobuf",
"@com_google_protobuf//:protoc_lib",
],
)
# Create a library of our protobuf message files
proto_library(
name = "gzmsgs_proto",
srcs = protos,
strip_import_prefix = "proto",
deps = [
"@com_google_protobuf//:any_proto",
],
)
gz_msgs_generate(
name = "gzmsgs_cc_proto",
deps = [
":gzmsgs_proto",
"@com_google_protobuf//:any_proto",
],
)
cc_library(
name = "msgs",
srcs = [
"src/Factory.cc",
"src/Filesystem.cc",
"src/Utility.cc",
":gzmsgs_cc_proto",
],
hdrs = public_headers,
includes = ["include"],
deps = [
":gzmsgs_cc_proto",
GZ_ROOT + "math",
"@com_google_protobuf//:protobuf",
"@tinyxml2",
],
)
test_sources = glob(
include = ["src/*_TEST.cc"],
exclude = [],
)
[cc_test(
name = src.replace("/", "_").replace(".cc", "").replace("src_", ""),
srcs = [src],
data = [
"test/desc",
],
defines = [
'GZ_MSGS_TEST_PATH=\\"msgs/test\\"',
],
deps = [
":msgs",
GZ_ROOT + "common/testing",
"@gtest",
"@gtest//:gtest_main",
],
) for src in test_sources]