Skip to content

TTK Module Migration to ParaView 5.7 VTK 9

Julien Tierny edited this page Jul 5, 2019 · 4 revisions

This document is meant for TTK developers who want to migrate modules made for the old CMake architecture (ParaView 5.6, VTK 8.2) to the new one (ParaView 5.7, VTK 9).

1 Recall old architecture

Here are the initial files for a simple module using on the old TTK CMake architecture:

  1. core/base/helloWorld/
    1. HelloWorld.cpp
    2. HelloWorld.h
    3. CMakeLists.txt
  2. core/vtk/ttkHelloWorld/
    1. ttkHelloWorld.cpp
    2. ttkHelloWorld.h
    3. CMakeLists.txt
  3. paraview/HelloWorld/
    1. HelloWorld.xml
    2. CMakeLists.txt
  4. standalone/HelloWorld/
    1. cmd/
    2. gui/

2 New architecture

  1. core/base/helloWorld/
    1. HelloWorld.cpp
    2. HelloWorld.h
    3. CMakeLists.txt
  2. core/vtk/ttkHelloWorld/
    1. ttkHelloWorld.cpp
    2. ttkHelloWorld.h
    3. HelloWorld.xml
    4. CMakeLists.txt
    5. TTKWrapper.cmake
    6. vtk.module
    7. ttk.module
  3. paraview/HelloWorld/
    1. TTKFilter.cmake
  4. standalone/HelloWorld/
    1. cmd/
    2. gui/

3 Migration

The base code does not change as this new architecture is driven by a new build system for CMake and ParaView. Also, the standalone are not impacted by the changes. This means we can focus on the 2. core/vtk and 3. paraview folders.

Core/vtk

As we can see above, in the new build system the XML files used to describe the module GUI is now inside the 2. core/vtk/ttkHelloWorld folder. You can simply move the file from 3. paraview/HelloWorld. Using the new build system, dependencies are declared using the 2. vii ttk.module file. The syntax of this file is quite simple:

NAME
  <ttkTarget>
SOURCES
  <source files>
HEADERS
  <header files>
DEPENDS
  <ttk base code targets required for this module>
XMLS
  <XML file>

You can fill this file using your old 2. iii CMakeLists.txt, adding the moved XML file in the according categorie.

The other files are straightforward to migrate:

  • The 2. iv. CMakeLists.txt now contains a single line: ttk_add_vtk_module() This creates the VTK module depending on the current TTK module. May be called by ParaView CMake files to build the plugins.
  • The 2. v. TTKWrapper.cmake file also contains a single line ttk_register_vtk_filter() This register the current module in the TTKVTK Target used to create the TTK library
  • The 2. vi. vtk.module file is almost the same for every modules. Simply copy an existing one and change the NAME by yout ttkTarget (as in the ttk.module)

ParaView

In the new architecture, the 3. paraview/HelloWorld folder only contains a simple TTKFilter.cmake with those lines:

# Allows to disable each filter
option(TTK_BUILD_HELLO_WORLD_FILTER "Build the HelloWorld filter" ON)
mark_as_advanced(TTK_BUILD_HELLO_WORLD_FILTER)

if(${TTK_BUILD_HELLO_WORLD_FILTER})
  ttk_register_pv_filter(pvHelloWorld ttkHelloWorld)
endif()

You can simply change HELLO_WORLD by the name of your filter, update the two targets in the ttk_register_pv_filter function and update the documentation.