CMakeLists.txt 8.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#==========================================================================
#
#     Program: ParaView
#
#     Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
#     All rights reserved.
#
#     ParaView is a free software; you can redistribute it and/or modify it
#     under the terms of the ParaView license version 1.2.
#
#     See License_v1.2.txt for the full ParaView license.
#     A copy of this license can be obtained by contacting
#     Kitware Inc.
#     28 Corporate Drive
#     Clifton Park, NY 12065
#     USA
#
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
set (Module_SRCS
  vtkInitializationHelper.cxx
)

vtk_module_library(vtkPVServerManagerApplication ${Module_SRCS})

#------------------------------------------------------------------------------
# Generate ServerManager (xml and CS stream) initialization header.
#------------------------------------------------------------------------------
set(vtk-module-init-functions)
set(vtk-module-init-calls)
set(_dependencies)
43 44
set(module_sm_xmls)

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
# Create list of the modules we are going to client server wrap.
# The user can specify a list in PARAVIEW_CS_MODULES
if (PARAVIEW_CS_MODULES)
  # use the user provide variable
  set(PARAVIEW_CURRENT_CS_MODULES ${PARAVIEW_CS_MODULES} CACHE INTERNAL "List of modules to CS wrap")
else()
  # Default to VTK_MODULES_ENABLED but need to filter the list first ( its
  # used else where without the guards below )
  set(_tmp_list)
  foreach (_module ${VTK_MODULES_ENABLED})
    if (NOT ${_module}_EXCLUDE_FROM_WRAPPING AND
        NOT ${_module}_IS_TEST AND
        NOT ${_module}_THIRD_PARTY)
      list(APPEND _tmp_list ${_module})
    endif()
  endforeach()
  set(PARAVIEW_CURRENT_CS_MODULES ${_tmp_list} CACHE INTERNAL "List of modules to CS wrap")
endif()

foreach (_module ${PARAVIEW_CURRENT_CS_MODULES})
65 66 67
  if (NOT ${_module}_EXCLUDE_FROM_WRAPPING AND
      NOT ${_module}_IS_TEST AND
      NOT ${_module}_THIRD_PARTY AND
68 69
        (NOT _module STREQUAL "vtkPVServerManagerApplication") AND
        (NOT _module MATCHES ".*Catalyst.*"))
70
    #message("${_module} == Adding")
71 72 73 74 75 76 77
    set(vtk-module-init-functions
      "${vtk-module-init-functions}extern \"C\" void ${_module}CS_Initialize(vtkClientServerInterpreter*);\n")
    set(vtk-module-init-calls
      "${vtk-module-init-calls}  ${_module}CS_Initialize(interp);\n")

    list(APPEND _dependencies ${_module}CS)
  endif()
78 79 80 81 82 83 84 85

  # if module provides server manager xmls, process them.
  get_property(module_xmls GLOBAL PROPERTY ${_module}_SERVERMANAGER_XMLS)
  if (module_xmls)
    foreach(xml_path IN LISTS module_xmls)
      list(APPEND module_sm_xmls ${xml_path})
    endforeach()
  endif()
86 87 88
endforeach()

# Add link-dependencies on all wrapping classes.
89 90
target_link_libraries(vtkPVServerManagerApplication
  LINK_PRIVATE ${_dependencies}
91
  LINK_PUBLIC vtkPVServerManagerCore)
92 93 94 95

#------------------------------------------------------------------------------
# Setup SM xmls. 
#------------------------------------------------------------------------------
96
SET(requestedResourceFiles
97
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/3d_widgets.xml
98
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/filters.xml
99
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/internal_writers.xml
100
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/readers.xml
101
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/rendering.xml
102 103
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/sources.xml
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/utilities.xml
104 105
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/views_and_representations.xml
  ${CMAKE_CURRENT_SOURCE_DIR}/Resources/writers.xml
106
  ${module_sm_xmls}
107
  )
108 109 110 111 112 113
if (PARAVIEW_USE_MPI)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_mpi.xml)
endif()

#------------------------------------------------------------------------------
114 115 116 117 118 119
list(FIND VTK_MODULES_ENABLED "vtkIOXdmf2" vtkioxdmf2_index)
if (vtkioxdmf2_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_xdmf2.xml)
endif()

120 121
list(FIND VTK_MODULES_ENABLED "vtkIOXdmf3" vtkioxdmf3_index)
if (vtkioxdmf3_index GREATER 0)
122 123 124
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_xdmf3.xml)
endif()
125

126 127 128 129 130 131
list(FIND VTK_MODULES_ENABLED "vtkIOGDAL" vtkiogdal_index)
if (vtkiogdal_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_gdal.xml)
endif()

Dan Lipsa's avatar
Dan Lipsa committed
132 133 134 135 136 137
list(FIND VTK_MODULES_ENABLED "vtkIOLAS" vtkiolas_index)
if (vtkiolas_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_las.xml)
endif()

Dan Lipsa's avatar
Dan Lipsa committed
138 139 140 141 142 143
list(FIND VTK_MODULES_ENABLED "vtkIOPDAL" vtkiopdal_index)
if (vtkiopdal_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_pdal.xml)
endif()

Dan Lipsa's avatar
Dan Lipsa committed
144 145 146 147 148 149
list(FIND VTK_MODULES_ENABLED "vtkIOSegY" vtkiosegy_index)
if (vtkiosegy_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_segy.xml)
endif()

Dan Lipsa's avatar
Dan Lipsa committed
150

151 152
list(FIND VTK_MODULES_ENABLED "vtkIOADIOS" vtkioadios_index)
if (vtkioadios_index GREATER 0)
153 154 155
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_adios.xml)
endif()
Mathieu Westphal's avatar
Mathieu Westphal committed
156

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
157 158 159 160 161 162
list(FIND VTK_MODULES_ENABLED "vtkIOMotionFX" vtkiomotionfx_index)
if (vtkiomotionfx_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_motionfx.xml)
endif()

Mathieu Westphal's avatar
Mathieu Westphal committed
163 164 165 166 167
if (PARAVIEW_USE_OPENTURNS)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/proxies_openturns.xml)
endif()

168 169 170 171 172 173 174
list(FIND VTK_MODULES_ENABLED "vtkFiltersMomentInvariants" vtkFiltersMomentInvariants_index)
if (vtkFiltersMomentInvariants_index GREATER 0)
  list(APPEND requestedResourceFiles
    ${CMAKE_CURRENT_SOURCE_DIR}/Resources/MomentInvariants.xml)
endif()


175
#------------------------------------------------------------------------------
176 177

if (PARAVIEW_ENABLE_PYTHON)
178
  list(APPEND requestedResourceFiles
179 180
      ${CMAKE_CURRENT_SOURCE_DIR}/Resources/pythonfilter.xml
  )
181
endif()
182 183 184 185 186 187
set(resourceFiles)
foreach(requestedResourceFile IN LISTS requestedResourceFiles)
  if (EXISTS "${requestedResourceFile}")
    list(APPEND resourceFiles "${requestedResourceFile}")
  endif ()
endforeach()
188 189 190
set (PARAVIEW_SERVERMANAGER_XMLS ${resourceFiles}
    CACHE INTERNAL "Server Manager XMLs")

191 192
add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vtkSMGeneratedModules.h
193
  DEPENDS ${resourceFiles} kwProcessXML
194
  COMMAND kwProcessXML
195 196 197
       ${CMAKE_CURRENT_BINARY_DIR}/vtkSMGeneratedModules.h
       vtkSMDefaultModules Interface GetInterfaces
       ${resourceFiles}
198 199 200 201 202
  COMMENT "Generating headers for ServerManager XMLs")
set_source_files_properties(vtkInitializationHelper.cxx
  PROPERTIES OBJECT_DEPENDS
  ${CMAKE_CURRENT_BINARY_DIR}/vtkSMGeneratedModules.h)

203 204 205 206 207 208 209 210 211 212 213 214

set (xml_init_code "")
foreach(rf ${resourceFiles})
  string(REGEX REPLACE "^.*/(.*).(xml|pvsm)$" "\\1" moduleName "${rf}")
  set (oneModule
"  init_string =  vtkSMDefaultModules${moduleName}GetInterfaces();
  xmls.push_back(init_string);
  delete[] init_string; init_string = NULL;")
  set(xml_init_code
    "${xml_init_code}\n${oneModule}")
endforeach()

215 216 217 218 219 220
#------------------------------------------------------------------------------
configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/vtkPVInitializer.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/vtkPVInitializer.h
  @ONLY)
#------------------------------------------------------------------------------