-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
BUILD.bazel
73 lines (63 loc) · 1.99 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
load(
"@drake//tools/skylark:drake_cc.bzl",
"drake_cc_googletest",
)
load("//tools/lint:lint.bzl", "add_lint_tests")
load("//tools/skylark:drake_data.bzl", "models_filegroup")
load("//tools/install:install_data.bzl", "install_data")
package(default_visibility = ["//visibility:public"])
# Convert the *.stl meshes to *.obj meshes, because many geometry and
# visualization tools in Drake only support *.obj meshes.
_STLS = glob(
["models/**/*.stl"],
allow_empty = False,
)
_OBJS = [x[:-3] + "obj" for x in _STLS]
[
# Recall this about genrules:
#
# - `srcs` are built for the "target" configuration, which is what all of
# our other programs and tests use; these will have a nice warm cache.
#
# - `tools` are built for the "exec" configuration, which is only ever used
# for genrules (or `tools` for any other flavor of rule); any large
# programs here will be costly to rebuild completely from scratch just
# for the genrule.
#
# Therefore, we add `stl2obj` as `srcs` (not `tools`) to avoid building it
# in the "exec" configuration all by its lonesome self. We want to use the
# same build of its dependencies as all of our regular code, for a smaller
# footprint and better caching.
genrule(
name = obj + "_genrule",
srcs = [stl] + ["//manipulation/util:stl2obj"],
outs = [obj],
cmd = " ".join([
"env TSAN_OPTIONS=report_bugs=0",
"$(location //manipulation/util:stl2obj)",
"--input=$(location {})".format(stl),
"--output=$@",
]),
visibility = ["//visibility:private"],
)
for stl, obj in zip(_STLS, _OBJS)
]
models_filegroup(
name = "models",
extra_srcs = _OBJS + [
"README.md",
],
)
install_data(
name = "install_data",
data = [":models"],
)
# === test/ ===
drake_cc_googletest(
name = "load_pr2_simplified_test",
data = [":models"],
deps = [
"//multibody/parsing",
],
)
add_lint_tests()