ParaView plugin project structure

Hi,
I am currently trying to make the switch from Inviwo to Paraview but the Plugin/module structure seems to elude me.

The project structure I have so far looks like as shown below. I have more filters but for the sake of simplicity I’ll only go through one here. The code is available at OpenTensorVis.

├── CMakeLists.txt
├── OpenTensorVis
│   ├── CMakeLists.txt
|   |── opentensorvis.plugin
│   ├── TensorFieldCriticalCellsFilter
│   │   ├── CMakeLists.txt
│   │   ├── tensorfieldcriticalcells.module
│   │   ├── TensirFieldCriticalCellsFilter.xml
│   │   ├── vtkTensorFieldCriticalCells.cxx
│   │   └── vtkTensorFieldCriticalCells.h

The top level CMakeLists.txt contains

cmake_minimum_required(VERSION 3.8)
project(OpenTensorVis-ParaView-Plugins)

find_package(ParaView REQUIRED)

set(CMAKE_CXX_STANDARD 20)

option(BUILD_SHARED_LIBS "Build shared libraries" ON)

include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

set("_paraview_plugin_default_${CMAKE_PROJECT_NAME}" ON)
paraview_plugin_scan(
  PLUGIN_FILES      "${CMAKE_CURRENT_SOURCE_DIR}/OpenTensorVis/opentensorvis.plugin"
  PROVIDES_PLUGINS  opentensorvis
  REQUIRES_MODULES  required_modules)

foreach (module IN LISTS required_modules)
  if (NOT TARGET "${module}")
    message(#FATAL_ERROR
      "Skipping example ${CMAKE_PROJECT_NAME}: Missing required module: "
      "${module}")
    return ()
  endif ()
endforeach ()

paraview_plugin_build(
  RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}"
  LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
  LIBRARY_SUBDIRECTORY "${PARAVIEW_PLUGIN_SUBDIR}"
  PLUGINS ${opentensorvis})

The opentensorvis.plugin file:

NAME
  OpenTensorVis
DESCRIPTION
  Implementations of the algorithms and methods developed in the OpenTensorVis project.
REQUIRES_MODULES
  VTK::CommonCore
  VTK::FiltersCore

The CMakeLists.txt for the plugin simply contains

paraview_add_plugin(OpenTensorVis
  VERSION "1.0"
  MODULES
    OpenTensorVis::TensorFieldCriticalCellsFilter
  MODULE_FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/TensorFieldCriticalCellsFilter/tensorfieldcriticalcells.module"
)

Last but not least, the tensorfieldcriticalcells.module file defines a simple module:

NAME
  OpenTensorVis::TensorFieldCriticalCellsFilter
LIBRARY_NAME
  vtkTensorFieldCriticalCellsFilter
DEPENDS
  VTK::FiltersCore
PRIVATE_DEPENDS
  VTK::CommonCore

with a corresponding CMakeLists.txt:

set(vtkTensorFieldCriticalCellsClasses
  vtkTensorFieldCriticalCells)

vtk_module_add_module(OpenTensorVis::TensorFieldCriticalCellsFilter
  CLASSES ${vtkTensorFieldCriticalCellsClasses})

paraview_add_server_manager_xmls(
  XMLS  TensorFieldCriticalCellsFilter.xml
)

CMake runs fine and everything compiles but when trying to load the plugin, ParaView throws the error

ERROR: In C:\bbd\6c27b535\build\superbuild\paraview\src\Remoting\Core\vtkPVPluginLoader.cxx, line 519
vtkPVPluginLoader (000001D855F1F2F0): The specified module could not be found.

I suppose I am mixing things up somewhere and I’d be happy about pointers as to where to look. Thanks!

You are not loading the right .so file, it is deeper in the build.

Modify your CMakeLists.txt like this to avoid this issue and generate a single .so file.

set(vtkTensorFieldCriticalCellsClasses
  vtkTensorFieldCriticalCells)

vtk_module_add_module(OpenTensorVis::TensorFieldCriticalCellsFilter
  FORCE_STATIC
  CLASSES ${vtkTensorFieldCriticalCellsClasses})

paraview_add_server_manager_xmls(
  XMLS  TensorFieldCriticalCellsFilter.xml
)

Hi,
thanks for the quick reply. I tried it out but ParaView throws the same error.

I’m just groping in the dark here but could the namespace in OpenTensorVis::TensorFieldCriticalCellsFilter cause trouble? Or the fact that the plugin is called OpenTensorVis and the namespace as well?

maybe, it is hard to say. I’d suggest trying with one the example that has a similar architecture and expand from there.

Does ldd have all libraries satisfied when you run it on the plugin that you’re trying to load? If not, you may be missing RPATH information somewhere. The output of readelf -d on the file may help there too.