Install VTK and integrate it in QT
Installation process
- follow the tutorial explained in this page clone this project from the this gitlab
- use
cmakeinstead ofccmake - change config in cmake-gui to
Release - after
configuringfor the first time, remember to change theuse qt(or smth similar) formdefaulttoYES - after generating the build files, you need to build the project using the
x64 native toolscmd - After the build is completed, you need to install it using the build system you chose (for integrating and using qtcreator, use
ninja) - re-run the
x64 native toolscmd as Admin - cd to the build folder, then do a
ninja install - At last, create a variable in the Environment setting, called
VTK_DIRand point it to the installed location (the defaule in cmake-gui isC:\Program Files (x86)\VTK\lib\cmake\vtk-9.3) - it’s done!
Integration process
- In order to actually be able to use the vtk in a project, you need to set up the
CMakeLists.txt. I can be done inside the QtCreator (under theprojectssetdxtings) or outside it from the cmake-gui (the same process.) - In either cases, you need to make the vtk be known to the cmake. You can call the tool by defining a path entry, called
VTK_DIRand assign it the value ofVTK_DIRvariable, defined earlier. - Then run the cmake. And Enjoy using VTK on Qt Projects!
This post is licensed under CC BY 4.0 by the author.