Difference between revisions of "Installing VTK on OS X"
Line 1: | Line 1: | ||
− | It took me a little while to get VTK compiled on OS X 10.5. It uses cmake, so it's not straightforward, but seems robust once you know the secret ways. Here's how I did it (this is largely based on the [http://www.vtk.org/Wiki/Cocoa_VTK vtk wiki], the instructions here and some fiddling). Note: this is using the CVS version (currently VTK 5.3) | + | It took me a little while to get VTK compiled on OS X 10.5. It uses cmake, so it's not straightforward, but seems robust once you know the secret ways. Here's how I did it (this is largely based on the [http://www.vtk.org/Wiki/Cocoa_VTK vtk wiki], [http://macresearch.org/installing_vtk_on_mac_os_x the instructions here] and some fiddling). Note: this is using the CVS version (currently VTK 5.3) |
First, install the [http://developer.apple.com/tools/download/ Apple Developer Tools (Xcode)], and [http://www.macports.org/ Macports], then open a terminal and use Macports to install CMake: | First, install the [http://developer.apple.com/tools/download/ Apple Developer Tools (Xcode)], and [http://www.macports.org/ Macports], then open a terminal and use Macports to install CMake: |
Latest revision as of 14:13, 9 October 2008
It took me a little while to get VTK compiled on OS X 10.5. It uses cmake, so it's not straightforward, but seems robust once you know the secret ways. Here's how I did it (this is largely based on the vtk wiki, the instructions here and some fiddling). Note: this is using the CVS version (currently VTK 5.3)
First, install the Apple Developer Tools (Xcode), and Macports, then open a terminal and use Macports to install CMake:
sudo port selfupdate sudo port install cmake
Create a directory for VTK, and download the CVS version of the software:
mkdir VTK cd VTK cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK login
enter 'vtk' as the password, then start the download:
cvs -d :pserver:anonymous@public.kitware.com:/cvsroot/VTK checkout VTK
Make a directory for the build and run cmake from that directory, pointing to the source you just downloaded:
mkdir VTKBuild cd VTKBuild cmake ../VTK
Cmake will make its config files based on the system info. These will be wrong, so we need to open CMakeCache.txt in a text editor and change the following (replace /Users/mark/VTK/VTKBuild with the path you chose above):
VTK_USE_CARBON:BOOL=OFF VTK_USE_COCOA:BOOL=ON CMAKE_BUILD_TYPE:STRING=Release CMAKE_EXE_LINKER_FLAGS:STRING=-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib CMAKE_INSTALL_PREFIX:PATH=/Users/mark/VTK/VTKBuild
Make sure to change the username in that last line to match your own. Then call cmake again and it will write out a makefile:
cmake ../VTK
Finally, compile and install:
make make install
If all is well, you should have a set of compiled libraries in VTKBuild/lib and include files in VTKBuild/include/vtk-5.3 (depending on the current VTK version number)
To use these for an XCode project, open the project, select Project->Edit Project Settings and under the Build tab change 'Library Search Paths' to include /Users/mark/VTK/VTKBuild/lib/ and 'Header Search Paths' to include /Users/mark/VTK/VTKBuild/include/vtk-5.3/ (changing the user name and version as appropriate)