Skip to content

Commit

Permalink
[workspace] Use VTK built from source
Browse files Browse the repository at this point in the history
Drake now uses a custom version of VTK that is compiled from source.

Users on macOS (who are not running Drake's unit tests) no longer need
the "robotlocomotion/director" tap and may remove it.

The following Bazel workspace externals are now deprecated:
- double_conversion
- glew
- liblz4
- liblzma
- vtk
The repository rules will continue to work during the deprecation
window, but Drake no longer installs their Ubuntu packages; if you
need the packages, ensure your project setup scripts install them.

For CMake users on Ubuntu 20.04 ("Focal"), Drake's source build and
pre-compiled binaries no longer provide a copy of VTK 9.1. If you still
need Drake's build of VTK 9.1 in your project, you can download it here:
- https://drake-packages.csail.mit.edu/vtk/vtk-9.1.0-3-focal-x86_64.tar.gz

To avoid ABI/ODR headaches, Drake's VTK build uses a custom namespace
and hidden symbols. This is particularly an advantage for wheel builds.

During manual testing on macOS, we found that RenderEngineVtk sometimes
does not obey show_window=true. It is not clear whether this is a new
bug due to the upgrade. Refer to issue 20144 for further discussion.
  • Loading branch information
jwnimmer-tri committed Sep 7, 2023
1 parent 82d7b13 commit 2011e1c
Show file tree
Hide file tree
Showing 52 changed files with 687 additions and 1,717 deletions.
6 changes: 3 additions & 3 deletions geometry/proximity/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ drake_cc_library(
],
deps = [
"@fmt",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOLegacy",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOLegacy",
],
)

Expand Down
14 changes: 7 additions & 7 deletions geometry/render_gl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ drake_cc_library_ubuntu_only(
":internal_opengl_context",
],
deps = [
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOImage",
"@vtk//:vtkImagingCore",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOImage",
"@vtk_internal//:vtkImagingCore",
],
)

Expand Down Expand Up @@ -242,9 +242,9 @@ drake_cc_googletest_ubuntu_only(
"//common/test_utilities:expect_throws_message",
"//geometry/render:render_label",
"//systems/sensors:color_palette",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOImage",
],
)

Expand Down
30 changes: 15 additions & 15 deletions geometry/render_gltf_client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ drake_cc_library(
"//systems/sensors:image",
"//systems/sensors:vtk_image_reader_writer",
"@picosha2_internal//:picosha2",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOImage",
],
)

Expand All @@ -124,10 +124,10 @@ drake_cc_library(
"//geometry/render_vtk:internal_render_engine_vtk",
"//systems/sensors:image",
"@nlohmann_internal//:nlohmann",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonMath",
"@vtk//:vtkIOExport",
"@vtk//:vtkRenderingCore",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonMath",
"@vtk_internal//:vtkIOExport",
"@vtk_internal//:vtkRenderingCore",
],
)

Expand Down Expand Up @@ -246,8 +246,8 @@ drake_cc_googletest(
"//common/test_utilities:expect_throws_message",
"//systems/sensors/test_utilities:image_compare",
"@nlohmann_internal//:nlohmann",
"@vtk//:vtkCommonMath",
"@vtk//:vtkRenderingCore",
"@vtk_internal//:vtkCommonMath",
"@vtk_internal//:vtkRenderingCore",
],
)

Expand All @@ -273,12 +273,12 @@ drake_cc_binary(
"//systems/sensors:color_palette",
"//systems/sensors:image",
"@gflags",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonMath",
"@vtk//:vtkIOImage",
"@vtk//:vtkIOImport",
"@vtk//:vtkRenderingCore",
"@vtk//:vtkRenderingOpenGL2",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonMath",
"@vtk_internal//:vtkIOImage",
"@vtk_internal//:vtkIOImport",
"@vtk_internal//:vtkRenderingCore",
"@vtk_internal//:vtkRenderingOpenGL2",
],
)

Expand Down
51 changes: 26 additions & 25 deletions geometry/render_vtk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ drake_cc_library(
"//geometry/render_vtk:render_engine_vtk_params",
"//systems/sensors:color_palette",
"@eigen",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonExecutionModel",
"@vtk//:vtkCommonTransforms",
"@vtk//:vtkFiltersSources",
"@vtk//:vtkIOGeometry",
"@vtk//:vtkIOImage",
"@vtk//:vtkIOImport",
"@vtk//:vtkImagingCore",
"@vtk//:vtkRenderingCore",
"@vtk//:vtkRenderingOpenGL2",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonExecutionModel",
"@vtk_internal//:vtkCommonTransforms",
"@vtk_internal//:vtkFiltersSources",
"@vtk_internal//:vtkIOGeometry",
"@vtk_internal//:vtkIOImage",
"@vtk_internal//:vtkIOImport",
"@vtk_internal//:vtkImagingCore",
"@vtk_internal//:vtkRenderingCore",
"@vtk_internal//:vtkRenderingOpenGL2",
],
)

Expand All @@ -87,12 +87,12 @@ drake_cc_library(
"//geometry:shape_specification",
"//geometry/render:render_material",
"//geometry/render:render_mesh",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkCommonExecutionModel",
"@vtk//:vtkCommonTransforms",
"@vtk//:vtkFiltersGeneral",
"@vtk//:vtkFiltersSources",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkCommonExecutionModel",
"@vtk_internal//:vtkCommonTransforms",
"@vtk_internal//:vtkFiltersGeneral",
"@vtk_internal//:vtkFiltersSources",
],
)

Expand All @@ -106,9 +106,9 @@ drake_cc_library(
"//common:essential",
"//math:geometric_transform",
"@eigen",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonTransforms",
"@vtk//:vtkFiltersSources",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonTransforms",
"@vtk_internal//:vtkFiltersSources",
],
)

Expand Down Expand Up @@ -138,6 +138,7 @@ drake_cc_googletest(
"RenderEngineVtkTest.PreservePropertyTexturesOverClone",
"RenderEngineVtkTest.RemoveVisual",
"RenderEngineVtkTest.SimpleClone",
"RenderEngineVtkTest.SingleLight",
"RenderEngineVtkTest.SphereTest",
"RenderEngineVtkTest.TerrainTest",
]),
Expand All @@ -155,19 +156,19 @@ drake_cc_googletest(
"//geometry/test_utilities:dummy_render_engine",
"//math:geometric_transform",
"//systems/sensors/test_utilities:image_compare",
"@vtk//:vtkIOImage",
"@vtk//:vtkRenderingCore",
"@vtk//:vtkRenderingOpenGL2",
"@vtk_internal//:vtkIOImage",
"@vtk_internal//:vtkRenderingCore",
"@vtk_internal//:vtkRenderingOpenGL2",
],
)

drake_cc_googletest(
name = "internal_vtk_util_test",
deps = [
":internal_vtk_util",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkFiltersSources",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkFiltersSources",
],
)

Expand Down
5 changes: 5 additions & 0 deletions geometry/render_vtk/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ namespace geometry {
/** Constructs a RenderEngine implementation which uses a VTK-based OpenGL
renderer.
@warning On macOS, we've observed that RenderEngineVtk sometimes does not obey
render::ColorRenderCamera::show_window when it's set to `true`. Refer to issue
<a href="https://github.com/RobotLocomotion/drake/issues/20144">#20144</a>
for further discussion.
@anchor render_engine_vtk_properties
<h2>Geometry perception properties</h2>
Expand Down
6 changes: 2 additions & 4 deletions setup/mac/binary_distribution/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ tap 'robotlocomotion/director'
cask 'adoptopenjdk' unless system '/usr/libexec/java_home --version 1.8+ --failfast &> /dev/null'

brew 'cmake'
brew 'double-conversion'
brew 'eigen'
brew 'gcc'
brew 'fmt'
brew 'glew'
brew 'glib'
brew 'graphviz'
brew 'ipopt'
brew 'jpeg'
brew 'libpng'
brew 'lz4'
brew 'libtiff'
brew 'numpy'
brew 'openblas'
brew 'pkg-config'
brew '[email protected]'
brew 'spdlog'
brew 'tinyxml'
brew 'robotlocomotion/director/[email protected]'
brew 'xz'
brew 'yaml-cpp'
brew 'zeromq'
Expand Down
2 changes: 0 additions & 2 deletions setup/ubuntu/binary_distribution/packages-focal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ libjchart2d-java
libjpeg-turbo8
libjsoncpp1
liblapack3
liblz4-1
liblzma5
libmumps-seq-5.2.1
libnetcdf15
libogg0
Expand Down
6 changes: 0 additions & 6 deletions setup/ubuntu/binary_distribution/packages-jammy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ default-jre
jupyter-notebook
libblas-dev
libbz2-1.0
libdouble-conversion3
libeigen3-dev
libexpat1
libfreetype6
libgfortran5
libglew2.2
libglib2.0-0
libglu1-mesa
libglx0
Expand All @@ -18,8 +15,6 @@ libjchart2d-java
libjpeg-turbo8
libjsoncpp25
liblapack3
liblz4-1
liblzma5
libmumps-seq-5.4
libnetcdf19
libogg0
Expand All @@ -34,7 +29,6 @@ libspdlog-dev
libsqlite3-0
libtheora0
libtiff5
libvtk9.1
libx11-6
libxml2
libxt6
Expand Down
4 changes: 0 additions & 4 deletions setup/ubuntu/source_distribution/packages-focal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ git
libblas-dev
libbz2-dev
libclang-12-dev
libdouble-conversion-dev
libexpat1-dev
libgl-dev
libglew-dev
libglib2.0-dev
libglx-dev
libjpeg-turbo8-dev
liblapack-dev
liblz4-dev
liblzma-dev
libmumps-seq-dev
libopengl-dev
libpng-dev
Expand Down
5 changes: 0 additions & 5 deletions setup/ubuntu/source_distribution/packages-jammy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@ gfortran
git
libbz2-dev
libclang-12-dev
libdouble-conversion-dev
libexpat1-dev
libgl-dev
libglew-dev
libglib2.0-dev
libglx-dev
libjpeg-turbo8-dev
liblapack-dev
liblz4-dev
liblzma-dev
libmumps-seq-dev
libopengl-dev
libpng-dev
libtiff-dev
libtinyxml-dev
libtool
libvtk9-dev
libx11-dev
ocl-icd-opencl-dev
opencl-headers
Expand Down
39 changes: 7 additions & 32 deletions systems/sensors/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ drake_cc_library(
":lcm_image_traits",
":vtk_image_reader_writer",
"//lcmtypes:image_array",
"@vtk//:vtkCommonCore",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkIOImage",
"@zlib",
],
)
Expand Down Expand Up @@ -321,9 +321,9 @@ drake_cc_library(
],
deps = [
":vtk_image_reader_writer",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOImage",
],
)

Expand All @@ -350,8 +350,8 @@ drake_cc_library(
deps = [
":image_file_format",
"//common:unused",
"@vtk//:vtkCommonCore",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkIOImage",
],
)

Expand Down Expand Up @@ -607,31 +607,6 @@ drake_cc_googletest(
":vtk_image_reader_writer",
"//common:temp_directory",
"//common/test_utilities:expect_throws_message",
"@vtk//:vtkCommonCore",
"@vtk//:vtkCommonDataModel",
"@vtk//:vtkIOImage",
],
)

# This "reader writer canary" is the same test program as above, but linked
# with @vtk_internal (VTK built from source) instead of @vtk (the host VTK).
# This is a temporary measure for CI to help us understand if the VTK source
# build is satisfactory. Once all of Drake has switched to @vtk_internal, we
# can (and should) remove this test rule, since it will be redundant.
drake_cc_googletest(
name = "vtk_image_reader_writer_canary_test",
srcs = [
"image_file_format.cc",
"image_file_format.h",
"test/vtk_image_reader_writer_test.cc",
"vtk_image_reader_writer.cc",
"vtk_image_reader_writer.h",
],
deps = [
"//common:essential",
"//common:temp_directory",
"//common:unused",
"//common/test_utilities:expect_throws_message",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkCommonDataModel",
"@vtk_internal//:vtkIOImage",
Expand Down
4 changes: 2 additions & 2 deletions systems/sensors/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ drake_cc_library(
deps = [
"//systems/sensors:image",
"@gtest//:without_main",
"@vtk//:vtkCommonCore",
"@vtk//:vtkIOImage",
"@vtk_internal//:vtkCommonCore",
"@vtk_internal//:vtkIOImage",
],
)

Expand Down
Loading

0 comments on commit 2011e1c

Please sign in to comment.