Paraview Make building Paraview plugin optional

From KitwarePublic
Revision as of 13:01, 29 November 2009 by Daviddoria (talk | contribs) (New page: If you develop a VTK filter for which you would like to make a Paraview plugin, it is nice to distribute it in a way that it can be used by users with only VTK as strictly a VTK filter, or...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you develop a VTK filter for which you would like to make a Paraview plugin, it is nice to distribute it in a way that it can be used by users with only VTK as strictly a VTK filter, or by users with both VTK and Paraview as a VTK filter and a Paraview plugin. To do this, the directory structure should be as follows:

..../MyFilter/MyFilter.h
..../MyFilter/MyFilter.cxx
..../MyFilter/CMakeLists.txt
..../MyFilter/plugin/CMakeLists.txt
..../MyFilter/plugin/MyFilter.xml

The MyFilter/CMakeLists.txt should look like

cmake_minimum_required(VERSION 2.6)
    if(COMMAND cmake_policy)
      cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)

PROJECT(vtkPointSetOutlierRemoval)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

SET(BUILD_PARAVIEW_PLUGIN OFF CACHE BOOL "Build Paraview plugin?")

if(BUILD_PARAVIEW_PLUGIN)
 SUBDIRS(plugin)
endif(BUILD_PARAVIEW_PLUGIN)

ADD_EXECUTABLE(vtkMyFilter Demo.cxx vtkMyFilter.cxx)
TARGET_LINK_LIBRARIES(vtkMyFilter vtkHybrid )

and the MyFilter/plugin/CMakeLists.txt should look like

FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES} ../)

ADD_PARAVIEW_PLUGIN(MyFilter "1.0"
  SERVER_MANAGER_XML MyFilterxml
SERVER_MANAGER_SOURCES ../MyFilter.cxx
)