Vs2012 compiling PCL dependency library vtk7.0

Software preparation:
1. Download the source code compression package VTK-7.0.0.zip from the VTK official website and extract it.
2. Download the installation package QT-Opensource-Windows-x86-MSVC2012_OpenGL-5.3.2. exe from the Qt official website, and install it by default.
3. Download the installation package cmake-3.0.2-win32-x86.exe from the official website of CMake, and install it by default.
Cmake set
1. Check Groupd and Advanced, and set the source code directory and build directory.
2. Press the Configure button, select VisualStudio 11 2012, click OK, and wait for the configuration to complete.
3. At the VTK node, locate and check VTK_GROUP_QT. Press the Configure button and wait for the configuration to complete. When done, CMake will report an error and click OK.
4. In the UngroundedEntries node with a red background, locate and change the value of VTK_QT_VERSION to 5. Set the value of QT_QMAKE_EXECUTABLE to C:/Qt/Qt5.3.2/5.3/msvc2012_opengl/bin/qmake. Exe. Press the Configure button and wait for the configuration to complete. When done, CMake will report an error and click OK.
5. In the UngroundedEntries node with red background, set the value of Qt5_DIR to C:/Qt/ qt5.3.2/5.3/msvc2012_opengl/lib/cmake/Qt5. Press the Configure button and wait for the configuration to complete. When done, CMake will no longer report errors.
6. On the CMAKE node, locate the CMAKE_INSTALL_PREFIX node and use the default Settings. This value is the installation directory of the VTK after compilation.
7. Click Add Entry button, set Name to CMAKE_DEBUG_POSTFIX, Type to STRING, Value to -GD, and click OK after setting. Press the Configure button and wait for the configuration to complete. Set this to ensure that the debug version of lib, DLL and release version of lib, the DLL name is different, to prevent later installation, both overwrite.
8. Click the Generate button and wait for the project VS file to be generated.
9. Locate the plugininstall. cmake file in the GUISupport\Qt folder of the build directory. Open it with Notepad and take line 5
SET (VTK_INSTALL_QT_PLUGIN_FILE QVTKWidgetPlugin. DLL)
Replace with
IF(BUILD_TYPE MATCHES Debug)
SET (VTK_INSTALL_QT_PLUGIN_FILE “QVTKWidgetPlugin – gd. DLL)”
ELSE()
SET (VTK_INSTALL_QT_PLUGIN_FILE QVTKWidgetPlugin. DLL)
ENDIF()
Note: Make sure that qvtkwidgetPlugin-gd.dll and qvtkwidgetPlugin.dll are surrounded by double quotation marks after substitution. Otherwise, subsequent compilation will return an error.
Save. This modification can prevent the QVTKWidgetPlugin file from being found when installing Qt plugin during debugging.

VS2012 compilation

1. Run VS as an administrator, click File, Open, and the dialog box pops up. Find the vtk.sln file in the path and open it.
2. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create.
3. Change the solution configuration to Release. In Solution Manager, go to ALL_BUILD, right-click, and click Build. Wait for VS to compile. When finished, find Install, click the right mouse button, and click Create.
4. After the above steps are completed, the compiled file will be in the path set by CMAKE_INSTALL_PREFIX.

Read More: