Skip to content

Commit

Permalink
[drake_ros] Vendor in VTK 9 depdendency
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI committed Oct 27, 2023
1 parent 8e8f411 commit e475875
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bazelized_drake_ros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
# TODO(sloretz) can't use rosdep here because we need the archive downloaded,
# but can't download the archive with bazel until we have the dependencies installed
# so bazel_ros2_rules can inspect it.
run: sudo apt-get install -y libconsole-bridge-dev
run: sudo apt-get install -y libconsole-bridge-dev libvtk9-dev
# CI for drake_ros.
- name: Build drake_ros
run: bazel build //...
Expand Down
6 changes: 5 additions & 1 deletion drake_ros/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ http_archive(

load("@drake//tools/workspace:default.bzl", "add_default_workspace")

add_default_workspace()
add_default_workspace(repository_excludes = ["vtk"])

load("//tools/workspace/vtk:repository.bzl", "vtk_repository")

vtk_repository(name = "vtk")
1 change: 1 addition & 0 deletions drake_ros/tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Empty BUILD file to mark package boundaries.
1 change: 1 addition & 0 deletions drake_ros/tools/workspace/vtk/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Empty BUILD file to mark package boundaries.
223 changes: 223 additions & 0 deletions drake_ros/tools/workspace/vtk/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# -*- mode: python -*-
# vi: set ft=python :

package(default_visibility = ["//visibility:public"])

cc_library(
name = "_headers",
hdrs = glob(["include/vtk-9.1/**"]),
includes = ["include/vtk-9.1"],
)

# Header-only libraries.
alias(name = "vtkkwiml", actual = "_headers")
alias(name = "vtkfmt", actual = "_headers")

# Shared libraries.
_LIB_DEPS = {
"vtkCommonColor": [
":vtkCommonCore",
":vtkCommonDataModel",
],
"vtkCommonComputationalGeometry": [
":vtkCommonCore",
":vtkCommonDataModel",
],
"vtkCommonCore": [
":vtkkwiml",
":vtkloguru",
":vtksys",
],
"vtkCommonDataModel": [
":vtkCommonCore",
":vtkCommonMath",
":vtkCommonMisc",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtksys",
":vtkpugixml",
],
"vtkCommonExecutionModel": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonMisc",
":vtkCommonSystem",
],
"vtkCommonMath": [
":vtkCommonCore",
":vtkkissfft",
],
"vtkCommonMisc": [
":vtkCommonCore",
":vtkCommonMath",
":vtksys",
],
"vtkCommonSystem": [
":vtkCommonCore",
":vtksys",
],
"vtkCommonTransforms": [
":vtkCommonCore",
":vtkCommonMath",
":vtksys",
],
"vtkDICOMParser": [
":vtksys",
],
"vtkFiltersCore": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonMisc",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtksys",
],
"vtkFiltersGeneral": [
":vtkCommonComputationalGeometry",
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonMisc",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtkFiltersCore",
":vtkfmt",
],
"vtkFiltersGeometry": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkFiltersCore",
":vtksys",
],
"vtkFiltersHybrid": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonMisc",
":vtkCommonTransforms",
":vtkFiltersGeometry",
":vtkFiltersCore",
":vtkFiltersGeneral",
":vtkImagingCore",
":vtkImagingSources",
":vtkRenderingCore",
":vtksys",
],
"vtkFiltersSources": [
":vtkCommonComputationalGeometry",
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonTransforms",
":vtkFiltersCore",
":vtkFiltersGeneral",
],
"vtkIOCore": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMisc",
":vtksys",
],
"vtkIOGeometry": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMisc",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtkFiltersGeneral",
":vtkFiltersHybrid",
":vtkImagingCore",
":vtkIOCore",
":vtkIOImage",
":vtkIOLegacy",
":vtkRenderingCore",
":vtksys",
],
"vtkIOImage": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonMisc",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtkDICOMParser",
":vtkImagingCore",
":vtkmetaio",
":vtkpugixml",
":vtksys",
],
"vtkIOLegacy": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMisc",
":vtkIOCore",
":vtksys",
],
"vtkImagingCore": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonTransforms",
],
"vtkImagingSources": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkImagingCore",
],
"vtkRenderingCore": [
":vtkCommonColor",
":vtkCommonComputationalGeometry",
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtkFiltersCore",
":vtkFiltersGeneral",
":vtkFiltersGeometry",
":vtkFiltersSources",
":vtksys",
],
"vtkRenderingOpenGL2": [
":vtkCommonCore",
":vtkCommonDataModel",
":vtkCommonExecutionModel",
":vtkCommonMath",
":vtkCommonSystem",
":vtkCommonTransforms",
":vtkFiltersGeneral",
":vtkRenderingCore",
":vtkRenderingUI",
":vtksys",
],
"vtkRenderingUI": [
":vtkRenderingCore",
],
"vtkkissfft": [],
"vtkloguru": [],
"vtkmetaio": [],
"vtkpugixml": [],
"vtksys": [],
}

# Add a rule for each shared library.
[
cc_library(
name = name,
linkopts = ["-l{}-9.1".format(name)],
deps = [":_headers"] + deps,
)
for name, deps in _LIB_DEPS.items()
]
13 changes: 13 additions & 0 deletions drake_ros/tools/workspace/vtk/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def _impl(repository_ctx):
repository_ctx.symlink(
"/usr/include/vtk-9.1",
"include/vtk-9.1",
)
repository_ctx.symlink(
Label("@//tools/workspace/vtk:package.BUILD.bazel"),
"BUILD.bazel",
)

vtk_repository = repository_rule(
implementation = _impl,
)
6 changes: 5 additions & 1 deletion drake_ros_examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ http_archive(

load("@drake//tools/workspace:default.bzl", "add_default_workspace")

add_default_workspace()
add_default_workspace(repository_excludes = ["vtk"])

load("@drake_ros_repo//tools/workspace/vtk:repository.bzl", "vtk_repository")

vtk_repository(name = "vtk")

0 comments on commit e475875

Please sign in to comment.