This installs the latest VTK which is, currently, 9.0.0.
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.
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.
What other requirements are there, probably, from memory:
- up-to-date cmake
xcode-select --install
run to get compilers installed