How to install VTK as a standalone package

I’m interested in building a project that embeds some visualization into a simple gui using VTK, for which I need to have the VTK development libraries/headers installed. Is it possible to link to the VTK libraries that are installed with ParaView? I noticed that PV installs all of the VTK libraries with a -pv5.6 suffix, which is makes it difficult to link to with other programs.

I guess instead of fixing the ParaView VTK, I’m assuming another option would be to build VTK first and then ParaView where to look for VTK instead of using the current git submodule setup.

Is one of these two options possible?

These are all being built using a recent git checkout of ParaView on a Linux system

Is it possible to link to the VTK libraries that are installed with ParaView?

No, it is not.

I guess instead of fixing the ParaView VTK, I’m assuming another option would be to build VTK first and then ParaView where to look for VTK instead of using the current git submodule setup.

Not possible either.

If you need VTK, you should download/build VTK.

Thanks for the quick reply mwestphal – I’ll build VTK on my own.

Regards,

Chris

You can also directly download a binary package here
https://www.vtk.org/download/

Can we find a mapping anywhere, which VTK version is embedded in which ParaView version?
Or does ParaView’s VTK evolve independently?

Why can’t ParaView simply use VTK libraries as a dependency? ParaView seems to do everything as complicated as possible, so that nobody grasps its design, including the ParaView developers.

If you compile ParaView from source with -DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON this will install the include files as well as the libraries. You can use these for your VTK libraries.

The include/paraview-5.6/vtkVersionMacros.h includes this type of information:

#define VTK_MAJOR_VERSION 8
#define VTK_MINOR_VERSION 2
#define VTK_BUILD_VERSION 0
#define VTK_VERSION "8.2.0"

I’m not really sure what you mean about linkage issues. I’ve never really bothered much there. I’ve just used this sort of thing:

#-----------------------------------------------------------------------------
# Simple discovery and sanity checks

if (EXISTS "$ENV{VTK_DIR}")
    message("Building with VTK from $ENV{VTK_DIR}")
    find_package(VTK REQUIRED HINTS $ENV{VTK_DIR})
    include(${VTK_USE_FILE})
elseif (EXISTS "$ENV{ParaView_DIR}")
    message("Building with Paraview from $ENV{ParaView_DIR}")
    find_package(ParaView REQUIRED HINTS $ENV{ParaView_DIR})
    include(${VTK_USE_FILE})
    set(
        VTK_VERSION
        "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}"
    )
else()
    message(FATAL_ERROR "VTK not found using VTK_DIR or ParaView_DIR")
endif()
#-----------------------------------------------------------------------------

And later on:

include(${VTK_USE_FILE})
...
target_link_libraries(
    myOwnTarget
    ${VTK_LIBRARIES}
    ${MYOWN_LIBRARIES}
)

Should I be concerned or doing something else? It doesn’t seem too terrible to me.

It would, however, be nice to have the includes are part of the standard binary package, but this is apparently not possible (see https://discourse.paraview.org/t/clean-paraview-build-link-for-plugin-development/).

/mark

There is no strict mapping. ParaView uses whatever hash of VTK to correspond to its need.
If you are interested, please take a look here: ParaView/Documentation/dev/git/develop.md at master · Kitware/ParaView · GitHub

Why can’t ParaView simply use VTK libraries as a dependency?
Because our VTK needs are too specific, some options need to be correctly set when building VTK.

@olesenm : It is indeed possible to use the build VTK inside of ParaView, but it does require to change the CMakeLists.txt of the project needing VTK, and not all of VTK is build by ParaView, so some projects may not work at all. We do not recommend it.