Build Instructions VTK - 3dct/open_iA GitHub Wiki
Up to Windows Build / Linux Build.
See also the official VTK build instructions.
Getting the Source Code
- Download the latest release source archive (.tar.gz) 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-9.1.0
on Windows or/home/developer/devel/vtk/src-9.1.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.
Configuration
- Start CMake.
- Make sure the "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-9.1.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 16 2019" / "Visual Studio 17 2022" 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, you'll want to 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:
Configuration options
If you don't see one of the settings described here, you probably forgot to check the "Advanced" checkmark as described above.
- Enable BUILD_SHARED_LIBS (should be enabled by default)
- Set
VTK_MODULE_ENABLE_VTK_GUISupportQt
toYES
- Set
VTK_MODULE_ENABLE_VTK_RenderingQt
toYES
- Set
VTK_MODULE_ENABLE_VTK_ViewsQt
toYES
- Set
VTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2
toYES
- Optional: Set
VTK_MODULE_ENABLE_VTK_RenderingOpenVR
,VTK_MODULE_ENABLE_VTK_RenderingOpenXR
or both toYES
if you plan to build the ImNDT/XVRA module; note that we so far only tested VR features under Windows, make sure to check the OpenVR or OpenXR section there). Note also that we experienced some issues with VR when using VTK version 9.2; currently we recommend to use VTK 9.1 if VR is required! - Press "Configure" again.
- You will probably receive an error message that CMake
Could not find a valid Qt installation
. In that case, set either theQt5_DIR
orQt6_DIR
variable to theversion/buildtype/lib/cmake/Qt5/6
sub-directory of the Qt installation folder (with Qt 6.3.2 and the Visual Studio 2019 64 bit build installed, you would need to set Qt6_DIR toQt-installation-dir/6.3.2/msvc2019_64/lib/cmake
) - Press "Configure" again.
- If you have enabled OpenVR by setting
VTK_MODULE_ENABLE_VTK_RenderingOpenVR
to YES, you will receive an error regarding CMake not finding the OpenVR SDK. To fix this:- Download the archive of the latest OpenVR SDK.
- Extract the archive.
- In the CMake window where you configure VTK:
- Set
OpenVR_INCLUDE_DIR
to theheaders
subfolder of where you extracted the OpenVR archive. - Set
OpenVR_LIBRARY
to the respective file required for linking to the SDK; on Windows, this is the filelib/win64/openvr_api.lib
inside the SDK, on Linux, this is the filebin/linux64/libopenvr_api.so
(inside of where you extracted the OpenVR archive).
- Set
- If you have enabled OpenXR by setting
VTK_MODULE_ENABLE_VTK_RenderingOpenXR
to YES, you will receive an error regarding CMake not finding the OpenXR SDK. To fix this:- Download the archive for the latest OpenXR SDK Source. Note that the Khronos Group currently only provides pre-built binaries for Windows; see the OpenXR section in the Windows build instructions for more details on the specific file to download.
- Extract the archive.
- In the CMake window where you configure VTK:
- Set
OpenXR_INCLUDE_DIR
to theinclude/openxr
subfolder of where you extracted the OpenXR archive. - Set
OpenXR_LIBRARY
to the loader library; on Windows, this is the filex64/lib/openxr_loader.lib
inside the SDK.
- Set
Finishing configuration
- 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). - 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".
Building
- 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:
Navigation:
- Up to Windows Build / Linux Build.
- Continue to Build Instructions OpenCL.