-
Notifications
You must be signed in to change notification settings - Fork 18
Build Instructions VTK
- Download the latest release source archive (.zip for VTK < 9 on Windows, tar.gz for all others) from VTK Downloads.
- Extract archive to an arbitrary folder; the folder containing the
CMakeLists.txt
is referenced on this page asvtk-src-dir
, this could e.g. beC:\Tools\vtk\VTK-8.2.0
on Windows or/home/developer/devel/vtk/src-8.2.0
on Linux). Note: On Windows, make sure that the full path you choose forvtk-src-dir
(andvtk-bin-dir
, see below) is not too long (recommendation: below 25 characters in total), otherwise you might see errors regarding the command line for moc being too long (see also troubleshooting below).
- Start CMake
- Make sure "Advanced" checkbox is ticked
- Specify
vtk-src-dir
under "Where is the source code", and an arbitraryvtk-bin-dir
(e.g. C:\Tools\vtk\bin-8.2.0) under "Where to build the binaries" - Press "Configure"
- Press "Yes" when asked whether the build directory should be created.
- When asked, specify the desired generator; e.g. "Visual Studio 14 2015" / "Visual Studio 15 2017" / "Visual Studio 16 2019" on Windows, or "Ninja" / "Unix Makefiles" on Linux; these generators are the ones that we use internally; choosing another generator should be no problem, but as we haven't tested them, you might encounter problems, if so please let us know!
- Typically, leave "Use default native compilers" checked; choose "Specify native compilers" if you know what you're doing and you want to use a different compiler (which you will be required to select in a next step).
- Depending on which version of VTK you are using, the options to set vary:
- Enable BUILD_SHARED_LIBS (should be enabled by default)
- Enable VTK_LEGACY_REMOVE (enable this flag on VTK > 8 if you are building open_iA >= 2018.12 or master/develop branches and have set OpenGL2 as VTK_RENDERING_BACKEND - older versions of open_iA require QVTKWidget(2) only available if legacy code is not removed)
- Enable VTK_LEGACY_SILENT (do not set this flag on VTK 8.1.x, as it potentially causes build problems there)
- Enable Module_vtkGUISupportQt
- Enable Module_vtkGUISupportQtOpenGL
- Enable Module_vtkRenderingQt
- Enable Module_vtkViewsQt
- Enable Module_vtkRenderingOpenVR (if you plan to build the VR module; see also the OpenVR section in the respective info for your operating system in Building open_iA)
- Set VTK_RENDERING_BACKEND to "OpenGL2". If building open_iA <= 2018.05, or if you are working on a system with a driver only supporting old OpenGL versions (requirement for OpenGL2 is GL version 3.2 with the gpu_shader4 extension), e.g. on a VirtualBox or on a Linux system with Intel graphics card, set VTK_RENDERING_BACKEND "OpenGL" (note that the "OpenGL" backend is only available in VTK <= 8.1.2).
- On Linux / on a non-multi-Set
CMAKE_BUILD_TYPE
to the build type you want to create (e.g., Debug if you plan to fix problems in open_iA, Release if you plan to use it productively and run long-running operations). - Press "Configure" again.
- You will probably receive Qt-related errors regarding version 4 of Qt not being found or a wrong version of Qt having been found. In that case, set VTK_Qt_VERSION to 5, and press "Configure" again.
- You will probably receive an error message that Qt5_DIR couldn't be determined. In that case, set the
Qt5_DIR
variable to theversion/buildtype/lib/cmake/Qt5
sub-directory of the Qt installation folder (with Qt 5.9.x and the Visual Studio 2015 64 bit build installed, this would be Qt-installation-dir/5.9/msvc2015_64/lib/cmake ) - Press "Configure" again.
- If you enabled OpenVR, you will receive an error regarding CMake not finding OpenVR; set OPENVR_ROOT_DIR to the base directory where you extracted the OpenVR SDK.
-
Enable BUILD_SHARED_LIBS (should be enabled by default)
-
Set VTK_MODULE_ENABLE_VTK_GUISupportQt to YES
-
Set VTK_MODULE_ENABLE_VTK_vtkRenderingQt to YES
-
Set VTK_MODULE_ENABLE_VTK_ViewsQt to YES
-
Set VTK_MODULE_ENABLE_VTK_RenderingOpenVR to YES (if you plan to build the VR module; see also the OpenVR section in the respective info for your operating system in Building open_iA)
-
Press "Configure" again.
-
You will probably receive an error message that Qt5_DIR couldn't be determined. In that case, set the
Qt5_DIR
variable to theversion/buildtype/lib/cmake/Qt5
sub-directory of the Qt installation folder (with Qt 5.9.x and the Visual Studio 2015 64 bit build installed, this would be Qt-installation-dir/5.9/msvc2015_64/lib/cmake ) -
Press "Configure" again.
-
If you enabled OpenVR, you will receive an error regarding CMake not finding OpenVR; set OPENVR_ROOT_DIR to the base directory where you extracted the OpenVR SDK.
-
You will probably receive an error message that Qt5_DIR couldn't be determined. In that case, set the
Qt5_DIR
variable to theversion/buildtype/lib/cmake/Qt5
sub-directory of the Qt installation folder (with Qt 5.9.x and the Visual Studio 2015 64 bit build installed, this would be Qt-installation-dir/5.9/msvc2015_64/lib/cmake )- When using a "single-configuration" generator, such as "Ninja" or "Unix Makefiles", also set
CMAKE_BUILD_TYPE
to the build type you want to create (e.g., Debug if you plan to fix problems in open_iA, Release if you plan to use it productively and run long-running operations). For Visual Studio generators, you don't need to create/modify this setting (it is a multi-configuration generator, the option typically even will not exist).
- When using a "single-configuration" generator, such as "Ninja" or "Unix Makefiles", also set
-
Press "Configure" one last time; If there still are errors, the corresponding messages should give you a hint as to what to do to resolve them.
-
When there are no more errors, and "Configuring done" is shown at the bottom of the log, press "Generate".
- On Windows with Visual Studio:
- Click "Open Project" (check carefully that it opens with the correct Visual Studio version in case you have multiple versions installed!), or open vtk.sln in
vtk-bin-dir
in Visual Studio - Build desired configuration(s) (for example Debug), e.g. via "Build"->"Build Solution", or multiple configurations at once via "Build"->"Batch Build".
- Click "Open Project" (check carefully that it opens with the correct Visual Studio version in case you have multiple versions installed!), or open vtk.sln in
- On Unix/Linux:
- Open a command line in
vtk-bin-dir
. - Depending on the chosen generator:
- If "Unix Makefiles", run
make -j 8
- the8
specifies the number of parallel compilations, you can adapt that to better match the number of (virtual) processor cores in your computer - If "Ninja, run
ninja
- If "Unix Makefiles", run
- Open a command line in
If there are any problems, check the respective troubleshooting section:
open_iA Documentation, licensed under CC BY-NC-SA 4.0