CMakeLists.txt 7.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
IF(NOT XDMF_INSTALL_INCLUDE_VTK_DIR)
    SET(XDMF_INSTALL_INCLUDE_VTK_DIR ${XDMF_INSTALL_INCLUDE_DIR})
ENDIF(NOT XDMF_INSTALL_INCLUDE_VTK_DIR)
IF(PV_INSTALL_BIN_DIR)
    SET(XDMF_INSTALL_BIN_DIR ${PV_INSTALL_BIN_DIR})
ENDIF(PV_INSTALL_BIN_DIR)
IF(PV_INSTALL_LIB_DIR)
    SET(XDMF_INSTALL_LIB_DIR ${PV_INSTALL_LIB_DIR})
ENDIF(PV_INSTALL_LIB_DIR)
IF(PV_INSTALL_INCLUDE_DIR)
    SET(XDMF_INSTALL_INCLUDE_DIR ${PV_INSTALL_INCLUDE_DIR})
ENDIF(PV_INSTALL_INCLUDE_DIR)

14
15
16
include(${ParaView_CMAKE_DIR}/VTKMono/vtkTargetExportMacros.cmake)
include(${ParaView_CMAKE_DIR}/VTKMono/vtkExportKit.cmake)

17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This Needs to be done since Xdmf/CMakeLists.txt !=
# PV/Utils/Xdmf2/CMakeLists.txt
# Because INSTALL_* commands require a leading / and because INSTALL (cmake
# 2.4
# and newer) requires no leading / to install under INSTALL_PREFIX, we
# are stripping the leading /. In the future, there should be no leading
# / in any install directory variables
STRING(REGEX REPLACE "^/" "" XDMF_INSTALL_LIB_DIR_CM24 "${XDMF_INSTALL_LIB_DIR}")
STRING(REGEX REPLACE "^/" "" XDMF_INSTALL_BIN_DIR_CM24 "${XDMF_INSTALL_BIN_DIR}")
STRING(REGEX REPLACE "^/" "" XDMF_INSTALL_INCLUDE_DIR_CM24 "${XDMF_INSTALL_INCLUDE_DIR}")
STRING(REGEX REPLACE "^/" "" XDMF_INSTALL_INCLUDE_VTK_DIR_CM24 "${XDMF_INSTALL_INCLUDE_VTK_DIR}")



Jerry Clarke's avatar
Jerry Clarke committed
31
SET( Xdmf_SRCS
32
  vtkSILBuilder.cxx
33
  vtkXdmfDataArray.cxx
34
  vtkXdmfHeavyData.cxx
35
36
37
38
#vtkXdmfOpenGLCamera.cxx
  vtkXdmfReader.cxx
  vtkXdmfReaderInternal.cxx
  vtkXdmfWriter.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
39
40
#${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
#vtkXdmfDataSetWriter.cxx
41
  )
42
SET_SOURCE_FILES_PROPERTIES(
43
  vtkXdmfReaderInternal
44
45
46
47
  vtkXdmfHeavyData
  WRAP_EXCLUDE
)

Jerry Clarke's avatar
Jerry Clarke committed
48

Alexander Neundorf's avatar
   
Alexander Neundorf committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
SET(USE_RENDER_WINDOW_INTERACTOR 1)
IF (OSMESA_LIBRARY AND NOT OPENGL_gl_LIBRARY)
  SET(USE_RENDER_WINDOW_INTERACTOR 0)
ENDIF (OSMESA_LIBRARY AND NOT OPENGL_gl_LIBRARY)

IF(APPLE)
  SET(USE_RENDER_WINDOW_INTERACTOR 0)
ENDIF(APPLE)

IF(USE_RENDER_WINDOW_INTERACTOR)
# Build vtkXdmf*RenderWindowInteractor.h
  IF(WIN32)
    SET(XDMF_WINDOWINTERACTOR vtkWin32RenderWindowInteractor)
    CONFIGURE_FILE(${Xdmf_SOURCE_DIR}/vtk/vtkXdmfRenderWindowInteractor.h.in
      ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.h
      @ONLY IMMEDIATE)
    CONFIGURE_FILE(${Xdmf_SOURCE_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx.in
      ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
      @ONLY IMMEDIATE)
  ELSE(WIN32)
    IF(VTK_USE_X)
      INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
    ENDIF(VTK_USE_X)
    SET(XDMF_WINDOWINTERACTOR vtkXRenderWindowInteractor)
    CONFIGURE_FILE(${Xdmf_SOURCE_DIR}/vtk/vtkXdmfRenderWindowInteractor.h.in
      ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.h
      @ONLY IMMEDIATE)
    CONFIGURE_FILE(${Xdmf_SOURCE_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx.in
      ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
      @ONLY IMMEDIATE)
  ENDIF(WIN32)

81
82
83
  SET(Xdmf_SRCS ${Xdmf_SRCS}
    ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
    )
Alexander Neundorf's avatar
   
Alexander Neundorf committed
84
ENDIF(USE_RENDER_WINDOW_INTERACTOR)
85

86
87
88
89
90
SET_SOURCE_FILES_PROPERTIES(
  vtkXdmfDataArray
  WRAP_EXCLUDE
  )

91
SET(VTK_BINARY_DIR "${Xdmf_BINARY_DIR}/vtk")
92
INCLUDE(${ParaView_CMAKE_DIR}/VTKMono/vtkExportKit.cmake)
93
VTK_EXPORT_KIT("Xdmf" "XDMF" "${Xdmf_SRCS}")
94

95
SET(VTK_BINARY_DIR "${Xdmf_BINARY_DIR}/vtk")
96
97
# if vtk was found include the use vtk file
IF (VTK_FOUND)
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
98
  
99
  IF(VTK_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
Andy Cedilnik's avatar
Andy Cedilnik committed
100
    SET(LIBTYPE SHARED)
101
  ELSE(VTK_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
Andy Cedilnik's avatar
Andy Cedilnik committed
102
    SET(LIBTYPE STATIC)
103
  ENDIF(VTK_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
104

105
106
  PVVTK_ADD_LIBRARY(vtkXdmf ${LIBTYPE} ${Xdmf_SRCS})
  add_dependencies(vtkXdmf vtklibxml2)
107
108
109
110
111
112
113
  set(_xdmf_link_lib 
    vtkIOCore
    Xdmf
    vtkRenderingOpenGL
    vtkInteractionStyle
    vtkRenderingFreeTypeOpenGL
    )
114

115
  IF(VTK_USE_PARALLEL)
116
    list(APPEND _xdmf_link_lib vtkParallelCore)
117
  ENDIF(VTK_USE_PARALLEL)
118

119
120
  target_link_libraries(vtkXdmf ${_xdmf_link_lib})

121
  IF (PARAVIEW_USE_MPI)
122
123
    # Needed for mpich 2
    ADD_DEFINITIONS("-DMPICH_IGNORE_CXX_SEEK")
124
  ENDIF (PARAVIEW_USE_MPI)
125

126
127
128
129
130
131
132
IF(XDMF_BUILD_MPI)
    # Building MPI 
ELSE(XDMF_BUILD_MPI)
    ADD_DEFINITIONS("-DXDMF_NO_MPI")
ENDIF(XDMF_BUILD_MPI)


133
134
  # Create Tcl wrappers if VTK is wrapped in Tcl.
  IF(VTK_WRAP_TCL)
Ken Martin's avatar
Ken Martin committed
135
    INCLUDE(${VTK_CMAKE_DIR}/vtkWrapTcl.cmake OPTIONAL)
136
    VTK_WRAP_TCL2(vtk${PROJECT_NAME}TCL XdmfTCL_SRCS ${Xdmf_SRCS})
137
    PVVTK_ADD_LIBRARY(vtk${PROJECT_NAME}TCL ${LIBTYPE} ${XdmfTCL_SRCS} ${Xdmf_SRCS})
138
139
140
141
142
    IF(VTK_USE_PARALLEL)
      TARGET_LINK_LIBRARIES(vtk${PROJECT_NAME}TCL vtkIOTCL vtkRenderingTCL vtkParallelTCL Xdmf)
    ELSE(VTK_USE_PARALLEL)
      TARGET_LINK_LIBRARIES(vtk${PROJECT_NAME}TCL vtkIOTCL vtkRenderingTCL Xdmf)
    ENDIF(VTK_USE_PARALLEL)
143
    ADD_DEPENDENCIES(vtk${PROJECT_NAME}TCL vtk${PROJECT_NAME})
144
145
  ENDIF(VTK_WRAP_TCL)

Jerry Clarke's avatar
Jerry Clarke committed
146
147
  # Create Python wrappers if VTK is wrapped in Python.
  IF(VTK_WRAP_PYTHON)
Ken Martin's avatar
Ken Martin committed
148
    INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake OPTIONAL)
149
    VTK_WRAP_PYTHON2(vtk${PROJECT_NAME}Python XdmfPython_SRCS ${Xdmf_SRCS})
150
    PVVTK_ADD_LIBRARY(vtk${PROJECT_NAME}Python MODULE ${XdmfPython_SRCS} ${Xdmf_SRCS})
151
152
    set(_xdmf_link_lib 
      vtkIOCorePythonD 
153
154
155
      vtkRenderingOpenGLPythonD
      vtkInteractionStyle
      vtkRenderingFreeTypeOpenGL
156
157
158
159
160
161
162
163
      Xdmf)
    
    if(VTK_USE_PARALLEL)
      list(APPEND _xdmf_link_lib vtkParallelCorePythonD) 
    endif()
    
    target_link_libraries(vtk${PROJECT_NAME}Python ${_xdmf_link_lib})
    
164
    ADD_DEPENDENCIES(vtk${PROJECT_NAME}Python vtk${PROJECT_NAME})
Jerry Clarke's avatar
Jerry Clarke committed
165
  ENDIF(VTK_WRAP_PYTHON)
166
ELSE(VTK_FOUND)
167
  MESSAGE(STATUS "Can't find VTK ... no vtkXdmf interface can be built")
Jerry Clarke's avatar
Jerry Clarke committed
168
ENDIF (VTK_FOUND)
Andy Cedilnik's avatar
Andy Cedilnik committed
169

170
IF(NOT XDMF_INSTALL_NO_DEVELOPMENT)
Burlen Loring's avatar
   
Burlen Loring committed
171
172
173
174
175
176
  FILE(GLOB dotHFiles 
      RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" 
      "*.h")
  FILE(GLOB binDotHFiles
      RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" 
     "${Xdmf_BINARY_DIR}/vtk/*.h")
Burlen Loring's avatar
   
Burlen Loring committed
177
178
179
  SET(devFiles "${dotHFiles};${binDotHFiles}")
  INSTALL(
      FILES ${devFiles}
180
181
      DESTINATION ${XDMF_INSTALL_INCLUDE_VTK_DIR_CM24}
      COMPONENT Development)
182
183
184
ENDIF(NOT XDMF_INSTALL_NO_DEVELOPMENT)
IF (VTK_FOUND)
  IF(NOT XDMF_INSTALL_NO_LIBRARIES)
185
      INSTALL(TARGETS vtkXdmf
186
	    EXPORT ${XDMF_INSTALL_EXPORT_NAME}
187
188
189
        RUNTIME DESTINATION ${XDMF_INSTALL_BIN_DIR_CM24} COMPONENT Runtime
        LIBRARY DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24} COMPONENT Runtime
        ARCHIVE DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24} COMPONENT Development)
190
    IF(VTK_WRAP_TCL)
Burlen Loring's avatar
   
Burlen Loring committed
191
192
      INSTALL(
          TARGETS vtk${PROJECT_NAME}TCL
193
          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24})
Burlen Loring's avatar
   
Burlen Loring committed
194
#       INSTALL_TARGETS(${XDMF_INSTALL_LIB_DIR} vtk${PROJECT_NAME}TCL)
195
196
    ENDIF(VTK_WRAP_TCL)
    IF(VTK_WRAP_PYTHON)
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211

      # Get the install path for python modules
      EXEC_PROGRAM("${PYTHON_EXECUTABLE}" "${Xdmf_SOURCE_DIR}/CMake/"
        ARGS "setup_install_paths.py" "purelib" --prefix=""
        OUTPUT_VARIABLE XDMF_WRAP_PYTHON_INSTALL_DIR)

      SET(XDMF_WRAP_PYTHON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}${XDMF_WRAP_PYTHON_INSTALL_DIR}/Xdmf)

      # Replace backslashes with forward slashes
      IF(WIN32)
      STRING(REGEX REPLACE "\\\\" "/" XDMF_WRAP_PYTHON_INSTALL_DIR
        "${XDMF_WRAP_PYTHON_INSTALL_DIR}")
      ENDIF(WIN32)

      IF(NOT PYTHON_INCLUDE_PATH)
212
        SET(PYTHON_INCLUDE_PATH ${XDMF_INSTALL_INCLUDE_VTK_DIR_CM24})
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
213
214
      ENDIF(NOT PYTHON_INCLUDE_PATH)

215
216
217
#      INSTALL(
#        TARGETS vtk${PROJECT_NAME}Python
#        DESTINATION ${XDMF_WRAP_PYTHON_INSTALL_DIR})
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
218
219
220
#       INSTALL(
#          TARGETS vtk${PROJECT_NAME}Python
#          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24})
Burlen Loring's avatar
   
Burlen Loring committed
221
#        INSTALL_TARGETS(${XDMF_INSTALL_LIB_DIR} vtk${PROJECT_NAME}Python)
222
223
224

      INSTALL(
          TARGETS vtk${PROJECT_NAME}Python
225
226
          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24}
          COMPONENT Development)
227
228
    ENDIF(VTK_WRAP_PYTHON)
  ENDIF(NOT XDMF_INSTALL_NO_LIBRARIES)
229

230
231
232
  IF(BUILD_TESTING)
    ADD_SUBDIRECTORY(Testing)
  ENDIF(BUILD_TESTING)
233

234
ENDIF (VTK_FOUND)