Installed in following order : openmp | mpi | cmake | vtk | ------------------------------- | Installation of VTK in Ubuntu (11.10 onward) |
||||
We typically use VTK together with Qt. To do that, please read the VTK with Qt section below. To install the latest version of VTK alone, you may try the following method. Installation of VTK is performed by compiling the source codes. Let's assume that you want to install VTK in /opt/VTK. Unzip the source files into /opt/VTK. Then, run the following commmands: cd /opt/VTK sudo cmake . sudo make sudo make install The last instruction will install the .h, .a and .cmake files under /usr/local, such as /usr/local/include/vtk-5.8 and /usr/local/lib/vtk-5.8.For convenience of upgrading, it would be useful to create symbolic links such as /usr/local/include/vtk and /usr/local/lib/vtk to these directories: cd /usr/local/include sudo ln -s vtk-5.8 vtk cd /usr/local/lib sudo ln -s vtk-5.8 vtk After installing VTK, go to the directory where cmake is installed, e.g., /usr/share/cmake-2.8. Then, go to the subdirectory Module and open the file FindVTK.cmake, and you'll see the following lines: # The following cache entries must be set by the user to locate VTK: # VTK_DIR - The directory containing VTKConfig.cmake. Insert a line into FindVTK.cmake to indicate where to find VTKConfig.cmake, in this case, SET(VTK_DIR "/usr/local/lib/vtk") This completes the installation process. For more information, refer to the README.html file that comes with the VTK source. |
|||||||||
VTK with Qt |
|||||||||
To use VTK with Qt, it is easier to install both Qt and VTK as follows: sudo apt-get install libqt4-dev libvtk5-qt4-dev If you want to use the lastest vesion of VTK with Qt, then install the latest version of VTK as discussed in the preceding section. Next, create a build directory such as /opt/VTK-build, go to the build directory and run sudo ccmake ../VTK In the text-based GUI, set the following options to "ON" by using arrow key to choose the option item and pressing enter to toggle the option: VTK_USE_QT VTK_USE_GUISUPPORT VTK_USE_QVTK Press c to configure, then press g to generate the Makefile. Finally, compile VTK using the Makefile: sudo make sudo make install The last command typically installs the .h and library files in /usr/local/include/vtk-5.8 and /usr/local/lib/vtk-5.8. |
|||||||||
Compiling VTK Programs |
|||||||||
To compile a VTK program, go to the directory that
contains the program, create the file CMakeLists.txt. This file contains
information that tells cmake how to generate the required make file.
For example, CMAKE_MINIMUM_REQUIRED(VERSION 2.8) PROJECT (test1) IF(NOT VTK_BINARY_DIR) FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE}) ENDIF(NOT VTK_BINARY_DIR) ADD_EXECUTABLE(test1 test1.cpp) TARGET_LINK_LIBRARIES(test1 vtkRendering) In this example, the name of the source file is test1.cpp and the names of the project and the executable are test1. After creating CMakeLists.txt, compile the program as follows: cmake . make The first command invokes cmake to create the makefile which make uses to compile the program. For more information of using cmake, refer to examples in VTK's tutorial /opt/VTK/Examples/Tutorial or Kitware's online page. |
|||||||||
Compiling Qt and VTK Programs |
|||||||||
Refer to Compiling Qt and VTK Programs web page for information. |
|||||||||
Documentation |
|||||||||
For online documentation, browse VTK online documentation. For offline documentation, download the html documentation from VTK website. Note that this documentation contains many, many files. |
Oct 28, 2014
Configuring VTK and cmake
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment