-
Notifications
You must be signed in to change notification settings - Fork 124
TTK Module Migration to ParaView 5.7 VTK 9
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).
Here are the initial files for a simple module using on the old TTK CMake architecture:
-
core/base/helloWorld/
HelloWorld.cpp
HelloWorld.h
CMakeLists.txt
-
core/vtk/ttkHelloWorld/
ttkHelloWorld.cpp
ttkHelloWorld.h
CMakeLists.txt
-
paraview/HelloWorld/
HelloWorld.xml
CMakeLists.txt
-
standalone/HelloWorld/
cmd/
gui/
-
core/base/helloWorld/
HelloWorld.cpp
HelloWorld.h
CMakeLists.txt
-
core/vtk/ttkHelloWorld/
ttkHelloWorld.cpp
ttkHelloWorld.h
HelloWorld.xml
CMakeLists.txt
TTKWrapper.cmake
vtk.module
ttk.module
-
paraview/HelloWorld/
TTKFilter.cmake
-
standalone/HelloWorld/
cmd/
gui/
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.
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)
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.