CMakeLists.txt 6.88 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
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)

# 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
28
SET( Xdmf_SRCS
29
  vtkSILBuilder.cxx
30
  vtkXdmfDataArray.cxx
31
  vtkXdmfHeavyData.cxx
32
33
34
35
#vtkXdmfOpenGLCamera.cxx
  vtkXdmfReader.cxx
  vtkXdmfReaderInternal.cxx
  vtkXdmfWriter.cxx
Alexander Neundorf's avatar
   
Alexander Neundorf committed
36
37
#${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
#vtkXdmfDataSetWriter.cxx
38
  )
39
SET_SOURCE_FILES_PROPERTIES(
40
  vtkXdmfReaderInternal
41
42
43
44
  vtkXdmfHeavyData
  WRAP_EXCLUDE
)

Jerry Clarke's avatar
Jerry Clarke committed
45

Alexander Neundorf's avatar
   
Alexander Neundorf committed
46
47
48
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
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)

78
79
80
  SET(Xdmf_SRCS ${Xdmf_SRCS}
    ${Xdmf_BINARY_DIR}/vtk/vtkXdmfRenderWindowInteractor.cxx
    )
Alexander Neundorf's avatar
   
Alexander Neundorf committed
81
ENDIF(USE_RENDER_WINDOW_INTERACTOR)
82

83
84
85
86
87
SET_SOURCE_FILES_PROPERTIES(
  vtkXdmfDataArray
  WRAP_EXCLUDE
  )

88
SET(VTK_BINARY_DIR "${Xdmf_BINARY_DIR}/vtk")
89
90
INCLUDE(${VTK_CMAKE_DIR}/vtkExportKit.cmake)
VTK_EXPORT_KIT("Xdmf" "XDMF" "${Xdmf_SRCS}")
91

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

102
  ADD_LIBRARY(vtkXdmf ${LIBTYPE} ${Xdmf_SRCS})
103
  TARGET_LINK_LIBRARIES(vtkXdmf vtkIO Xdmf vtkRendering vtkParallel)
104

105
106
107
108
109
  IF (VTK_USE_MPI)
    # Needed for mpich 2
    ADD_DEFINITIONS("-DMPICH_IGNORE_CXX_SEEK")
  ENDIF (VTK_USE_MPI)

110
111
112
113
114
115
116
IF(XDMF_BUILD_MPI)
    # Building MPI 
ELSE(XDMF_BUILD_MPI)
    ADD_DEFINITIONS("-DXDMF_NO_MPI")
ENDIF(XDMF_BUILD_MPI)


117
118
  # Create Tcl wrappers if VTK is wrapped in Tcl.
  IF(VTK_WRAP_TCL)
Ken Martin's avatar
Ken Martin committed
119
    INCLUDE(${VTK_CMAKE_DIR}/vtkWrapTcl.cmake OPTIONAL)
120
    VTK_WRAP_TCL2(vtk${PROJECT_NAME}TCL XdmfTCL_SRCS ${Xdmf_SRCS})
Andy Cedilnik's avatar
Andy Cedilnik committed
121
    ADD_LIBRARY(vtk${PROJECT_NAME}TCL ${LIBTYPE} ${XdmfTCL_SRCS} ${Xdmf_SRCS})
122
    TARGET_LINK_LIBRARIES(vtk${PROJECT_NAME}TCL vtkIOTCL vtkRenderingTCL vtkParallelTCL Xdmf)
123
    ADD_DEPENDENCIES(vtk${PROJECT_NAME}TCL vtk${PROJECT_NAME})
124
125
  ENDIF(VTK_WRAP_TCL)

Jerry Clarke's avatar
Jerry Clarke committed
126
127
  # Create Python wrappers if VTK is wrapped in Python.
  IF(VTK_WRAP_PYTHON)
Ken Martin's avatar
Ken Martin committed
128
    INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake OPTIONAL)
129
    VTK_WRAP_PYTHON2(vtk${PROJECT_NAME}Python XdmfPython_SRCS ${Xdmf_SRCS})
130
    ADD_LIBRARY(vtk${PROJECT_NAME}Python MODULE ${XdmfPython_SRCS} ${Xdmf_SRCS})
131
    TARGET_LINK_LIBRARIES(vtk${PROJECT_NAME}Python vtkIOPythonD
132
      vtkRenderingPythonD vtkParallelPythonD Xdmf)
133
    ADD_DEPENDENCIES(vtk${PROJECT_NAME}Python vtk${PROJECT_NAME})
Jerry Clarke's avatar
Jerry Clarke committed
134
  ENDIF(VTK_WRAP_PYTHON)
135
ELSE(VTK_FOUND)
136
  MESSAGE(STATUS "Can't find VTK ... no vtkXdmf interface can be built")
Jerry Clarke's avatar
Jerry Clarke committed
137
ENDIF (VTK_FOUND)
Andy Cedilnik's avatar
Andy Cedilnik committed
138

139
IF(NOT XDMF_INSTALL_NO_DEVELOPMENT)
Burlen Loring's avatar
   
Burlen Loring committed
140
141
142
143
144
145
  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
146
147
148
  SET(devFiles "${dotHFiles};${binDotHFiles}")
  INSTALL(
      FILES ${devFiles}
149
150
      DESTINATION ${XDMF_INSTALL_INCLUDE_VTK_DIR_CM24}
      COMPONENT Development)
151
152
153
ENDIF(NOT XDMF_INSTALL_NO_DEVELOPMENT)
IF (VTK_FOUND)
  IF(NOT XDMF_INSTALL_NO_LIBRARIES)
154
      INSTALL(TARGETS vtkXdmf
155
156
157
        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)
158
    IF(VTK_WRAP_TCL)
Burlen Loring's avatar
   
Burlen Loring committed
159
160
      INSTALL(
          TARGETS vtk${PROJECT_NAME}TCL
161
          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24})
Burlen Loring's avatar
   
Burlen Loring committed
162
#       INSTALL_TARGETS(${XDMF_INSTALL_LIB_DIR} vtk${PROJECT_NAME}TCL)
163
164
    ENDIF(VTK_WRAP_TCL)
    IF(VTK_WRAP_PYTHON)
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

      # 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)
180
        SET(PYTHON_INCLUDE_PATH ${XDMF_INSTALL_INCLUDE_VTK_DIR_CM24})
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
181
182
      ENDIF(NOT PYTHON_INCLUDE_PATH)

183
184
185
#      INSTALL(
#        TARGETS vtk${PROJECT_NAME}Python
#        DESTINATION ${XDMF_WRAP_PYTHON_INSTALL_DIR})
Kenneth Leiter's avatar
ENH:    
Kenneth Leiter committed
186
187
188
#       INSTALL(
#          TARGETS vtk${PROJECT_NAME}Python
#          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24})
Burlen Loring's avatar
   
Burlen Loring committed
189
#        INSTALL_TARGETS(${XDMF_INSTALL_LIB_DIR} vtk${PROJECT_NAME}Python)
190
191
192

      INSTALL(
          TARGETS vtk${PROJECT_NAME}Python
193
194
          DESTINATION ${XDMF_INSTALL_LIB_DIR_CM24}
          COMPONENT Development)
195
196
    ENDIF(VTK_WRAP_PYTHON)
  ENDIF(NOT XDMF_INSTALL_NO_LIBRARIES)
197

198
199
200
  IF(BUILD_TESTING)
    ADD_SUBDIRECTORY(Testing)
  ENDIF(BUILD_TESTING)
201

202
ENDIF (VTK_FOUND)