Skip to content

Instantly share code, notes, and snippets.

@mdaley
Last active May 24, 2020 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdaley/843b978826c9ad5ef4fc83a4852854be to your computer and use it in GitHub Desktop.
Save mdaley/843b978826c9ad5ef4fc83a4852854be to your computer and use it in GitHub Desktop.

VTK

This installs the latest VTK which is, currently, 9.0.0.

Build on OSX

Clone the project:

git clone git@github.com:Kitware/VTK.git

Install QT:

brew install qt

(gets QT installed in /usr/local/Cellar/qt/5.14.2 at the moment)

Add /usr/local/Cella/qt/5.14.2/bin to PATH. Don't know if essential or not.

Building (couldn't find this exact information anywhere else, so cobbled together from various hard-to-find sources):

cd VTK
mkdir build
cd build
ccmake .. -G "Unix Makefiles" -DQT_QMAKE_EXECUTABLE:PATH=/usr/local/Cellar/qt/5.14.2/bin/qmake \
    -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING=YES \
    -DVTK_USE_QVTX:BOOL=ON \
    -DVTK_USE_CARBON:BOOL=ON \
    -DMAKE_INSTALL_PREFIX=/usr/local \
    -DVTK_USE_GUISUPPORT:BOOL=ON
make -j8
make install

The main issue seems to be getting RenderingContextOpenGL2 installed without which you can't compile and run example projects. Probably works directly with cmake. However, at least ccmake allows you to see the settings for build which gives a bit of a clue as to what is going on.

Getting and running an example

wget https://github.com/lorensen/VTKWikiExamplesTarballs/raw/master/LinePlot.tar
tar xvf LinePlot.tar
cd LinePlot
cmake .
make
./LinePlot.app/Contents/MacOS/LinePlot

This works. Before I managed to build VTK correctly, I would get cmake errors like this:

Skipping LinePlot: Could not find the VTK package with the following required components: RenderingContextOpenGL2.

Other requirements

What other requirements are there, probably, from memory:

  • up-to-date cmake
  • xcode-select --install run to get compilers installed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment