Tag Archives: VTK source

[VTK] cmake compiling VTK

Compile VTK source code with CMKAE
1. Install Cmake
Download the installation package: http://www.cmake.org/download/
Select the.exe file to download and install it on your local computer.
2. Get the VTK source code
2.1 source url: http://www.vtk.org/download/
Download vtk-6.2.0.zip (VTK source code) vtkdata-6.2.0.zip (data) vtkdochtml-6.2.0.tar.gz (help document)
2.2 Unzip to local folder
Unzip vtk-6.2.0.zip to F:\vtk_6.2\ VTK
Unzip vtkdata-6.2.0.zip to F:\vtk_6.2\ VTKData
Unzip vtkdochtml-6.2.0.tar. gz to F:\vtk_6.2\vtkDocHtml
3. Run cmake to compile
Select the Source Code directory as F:\vtk_6.2\ VTK
Select the bin directory after build as F:\vtk_6.2\bin
Click the Configure button, the selection compiler pops up, I chose Visual Studio 2010, automatically scan the required files.
4. Modify Cmake parameter (On is ticked)
4.1 BUILD_EXAMPLES Select ON, which you can use to learn about VTK examples
4.2 BUILD_SHARED_LIBS Select ON to generate dynamic link library DLLs
4.3 MODULE_VTKGUISUPPORTQT Select ON to support QT interface (click Advanced parameters, this option will appear)
4.4 CNAJE_INSTALL_PREFIX = C: \ ProgramFiles \ VTK
Then, click the Configure button again and let CMake scan the configuration file again. When it runs successfully, the red color will disappear from the page. If it still has red color, see what else needs to be selected on the red TAB
At the end of the scan, click the Generate button to Generate the VS project of VTK.
5. Open the VS project of VTK and compile it
Open the vtk.sln project in the F:\vtk_6.2\bin directory
The first step is to select the type of file to output, Debug or Release for ALL_BUILD and INSTALL, as shown in the figure below.

The default Files are in the C: Program Files\VTK folder. Copy it into an environment variable and program it