-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathBUILD.bazel
83 lines (73 loc) · 1.8 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
# -*- python -*-
load("@drake//tools/install:install.bzl", "install")
load("//tools/lint:lint.bzl", "add_lint_tests")
load(
"//tools/skylark:pybind.bzl",
"drake_pybind_library",
"get_drake_pybind_installs",
"get_pybind_package_info",
)
load(
"//tools/skylark:drake_py.bzl",
"drake_py_binary",
"drake_py_library",
"drake_py_test",
)
load(
"//tools/skylark:6996.bzl",
"adjust_label_for_drake_hoist",
"adjust_labels_for_drake_hoist",
)
package(default_visibility = adjust_labels_for_drake_hoist([
"//drake/bindings/pydrake:__subpackages__",
]))
# This determines how `PYTHONPATH` is configured, and how to install the
# bindings.
PACKAGE_INFO = get_pybind_package_info(
base_package = adjust_label_for_drake_hoist("//drake/bindings"),
)
# @note Symbols are NOT imported directly into
# `__init__.py` to simplify dependency management, meaning that
# classes are organized by their directory structure rather than
# by C++ namespace.
drake_py_library(
name = "module_py",
srcs = ["__init__.py"],
imports = PACKAGE_INFO.py_imports,
deps = [
"//drake/bindings/pydrake:common_py",
],
)
drake_pybind_library(
name = "pendulum_py",
cc_so_name = "pendulum",
cc_srcs = ["pendulum_py.cc"],
cc_deps = [
"//drake/examples/pendulum:pendulum_plant",
],
package_info = PACKAGE_INFO,
py_deps = [
":module_py",
],
)
PYBIND_LIBRARIES = [
":pendulum_py",
]
PY_LIBRARIES = [
":module_py",
]
install(
name = "install",
targets = PY_LIBRARIES,
py_dest = PACKAGE_INFO.py_dest,
deps = get_drake_pybind_installs(PYBIND_LIBRARIES),
)
drake_py_test(
name = "pendulum_test",
size = "small",
deps = [
":pendulum_py",
"//drake/bindings/pydrake/systems:systems",
],
)
add_lint_tests()