paraview.cmake 8.82 KB
Newer Older
Ben Boeckel's avatar
Ben Boeckel committed
1
set(PARAVIEW_EXTRA_CMAKE_ARGUMENTS ""
Ben Boeckel's avatar
Ben Boeckel committed
2
  CACHE STRING "Extra arguments to be passed to ParaView when configuring.")
Ben Boeckel's avatar
Ben Boeckel committed
3
4
mark_as_advanced(PARAVIEW_EXTRA_CMAKE_ARGUMENTS)

5
6
option(PARAVIEW_DEFAULT_SYSTEM_GL "Default to using the system OpenGL" OFF)

Ben Boeckel's avatar
Ben Boeckel committed
7
8
9
10
11
12
13
set (paraview_extra_cmake_options)
if (PV_NIGHTLY_SUFFIX)
  list(APPEND paraview_extra_cmake_options
    -DPV_NIGHTLY_SUFFIX:STRING=${PV_NIGHTLY_SUFFIX})
endif ()

set(paraview_install_development_files FALSE)
14
if ((UNIX AND NOT APPLE) OR paraviewsdk_enabled)
Ben Boeckel's avatar
Ben Boeckel committed
15
16
17
  set(paraview_install_development_files TRUE)
endif ()

18
19
# Without an offscreen rendering backend, X should be used.
set(paraview_use_x ON)
20
if (WIN32 OR APPLE OR osmesa_enabled OR egl_enabled)
21
  set(paraview_use_x OFF)
22
23
endif()

24
set(paraview_all_plugins)
Ben Boeckel's avatar
Ben Boeckel committed
25
26
27
28

if (superbuild_build_phase)
  get_property(paraview_plugins GLOBAL
    PROPERTY paraview_plugins)
29
30
  get_property(paraview_plugin_dirs_external GLOBAL
    PROPERTY paraview_plugin_dirs_external)
Ben Boeckel's avatar
Ben Boeckel committed
31

32
33
  set(paraview_plugin_dirs
    "${paraview_plugin_dirs_external}")
Ben Boeckel's avatar
Ben Boeckel committed
34
35
36
37
38
39
40
41
42
43
  foreach (paraview_plugin IN LISTS paraview_plugins)
    if (${paraview_plugin}_enabled AND TARGET "${paraview_plugin}")
      set(plugin_source_dir "<SOURCE_DIR>")
      _ep_replace_location_tags("${paraview_plugin}" plugin_source_dir)
      list(APPEND paraview_plugin_dirs
        "${plugin_source_dir}")
    endif ()
  endforeach ()
  string(REPLACE ";" "${_superbuild_list_separator}" paraview_plugin_dirs "${paraview_plugin_dirs}")
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

if (NOT CMAKE_CONFIGURATION_TYPES AND NOT WIN32)
  set(PARAVIEW_BUILD_TYPE ""
    CACHE STRING "ParaView's build mode")
  mark_as_advanced(PARAVIEW_BUILD_TYPE)
  if (NOT PARAVIEW_BUILD_TYPE)
    set(PARAVIEW_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
  endif ()

  set(CMAKE_BUILD_TYPE_save "${CMAKE_BUILD_TYPE}")
  set(CMAKE_BUILD_TYPE "${PARAVIEW_BUILD_TYPE}")
endif ()

set(paraview_smp_backend "Sequential")
if (tbb_enabled)
  set(paraview_smp_backend "TBB")
endif ()

62
63
64
65
66
set(paraview_enable_cuda "OFF")
if(vtkm_enabled AND cuda_enabled)
  set(paraview_enable_cuda "ON")
endif()

Ben Boeckel's avatar
Ben Boeckel committed
67
68
69
70
set(PARAVIEW_EXTERNAL_PROJECTS ""
  CACHE STRING "A list of projects for ParaView to depend on")
mark_as_advanced(PARAVIEW_EXTERNAL_PROJECTS)

71
option(PARAVIEW_FREEZE_PYTHON "Freeze Python packages and modules into the application" OFF)
Ben Boeckel's avatar
Ben Boeckel committed
72

73
74
75
76
set(paraviews_platform_dependencies)
if (UNIX)
  if (NOT APPLE)
    list(APPEND paraviews_platform_dependencies
Ben Boeckel's avatar
Ben Boeckel committed
77
      mesa osmesa egl
78

79
80
      boxlib

81
82
      # Needed for fonts to work properly.
      fontconfig)
83
84
  endif ()
  list(APPEND paraviews_platform_dependencies
Dan Lipsa's avatar
Dan Lipsa committed
85
    adios ffmpeg libxml2 freetype
86
87

    # For cosmotools
88
    genericio cosmotools)
89
90
endif ()

91
set(paraview_mesa_libdir "<LIBDIR>")
92
if (PARAVIEW_DEFAULT_SYSTEM_GL AND mesa_enabled)
93
  set(paraview_mesa_libdir "<LIBDIR>/mesa")
94
95
endif ()

Ken Martin's avatar
Ken Martin committed
96
97
if (WIN32)
  list(APPEND paraviews_platform_dependencies
Ben Boeckel's avatar
Ben Boeckel committed
98
    openvr)
Ken Martin's avatar
Ken Martin committed
99
100
endif ()

101
102
103
104
105
if (USE_NONFREE_COMPONENTS AND (WIN32 OR (UNIX AND NOT APPLE)))
  list(APPEND paraviews_platform_dependencies
    visrtx)
endif ()

106
107
108
109
110
set(PARAVIEW_ENABLE_PYTHON ${python_enabled})
if (python_enabled AND USE_SYSTEM_python AND NOT python_FIND_LIBRARIES)
  set(PARAVIEW_ENABLE_PYTHON OFF)
endif()

Ben Boeckel's avatar
Ben Boeckel committed
111
if (expat_enabled)
Chuck Atkins's avatar
Chuck Atkins committed
112
113
  list(APPEND paraviews_platform_dependencies expat)
endif ()
114

115
116
117
118
119
120
121
122
123
124
cmake_dependent_option(PARAVIEW_INITIALIZE_MPI_ON_CLIENT
  "Initialize MPI on client-processes by default. Can be overridden using command line arguments" ON
  "mpi_enabled" OFF)
mark_as_advanced(PARAVIEW_INITIALIZE_MPI_ON_CLIENT)

if (mpi_enabled)
  list(APPEND paraview_extra_cmake_options
    -DPARAVIEW_INITIALIZE_MPI_ON_CLIENT:BOOL=${PARAVIEW_INITIALIZE_MPI_ON_CLIENT})
endif()

125
126
127
option(PARAVIEW_ENABLE_MOTIONFX "Enable MotionFX reader, if supported on platform" ON)
mark_as_advanced(PARAVIEW_ENABLE_MOTIONFX)

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
128
129
130
131
132
133
if(adios_enabled)
  set(adios_module_flag "YES")
else()
  set(adios_module_flag "NO")
endif()

134
135
136
137
138
set(paraview_use_raytracing OFF)
if (ospray_enabled OR visrtx_enabled)
  set(paraview_use_raytracing ON)
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
139
superbuild_add_project(paraview
Ben Boeckel's avatar
Ben Boeckel committed
140
  DEBUGGABLE
Ben Boeckel's avatar
Ben Boeckel committed
141
  DEFAULT_ON
Ben Boeckel's avatar
Ben Boeckel committed
142
143
  DEPENDS
    hdf5
Ben Boeckel's avatar
Ben Boeckel committed
144
  DEPENDS_OPTIONAL
Ben Boeckel's avatar
Ben Boeckel committed
145
    cuda boost matplotlib mpi numpy png
Dan Lipsa's avatar
Dan Lipsa committed
146
    python qt5 visitbridge zlib silo las
Robert Maynard's avatar
Robert Maynard committed
147
    xdmf3 ospray vrpn vtkm tbb netcdf
148
    nlohmannjson
149
150
    paraviewgettingstartedguide
    paraviewtutorialdata paraviewweb
151
    paraviewpluginsexternal
Ben Boeckel's avatar
Ben Boeckel committed
152
    ${paraview_all_plugins}
153
    ${paraviews_platform_dependencies}
Ben Boeckel's avatar
Ben Boeckel committed
154
155
156
    ${PARAVIEW_EXTERNAL_PROJECTS}

  CMAKE_ARGS
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
157
158
    -DPARAVIEW_BUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
    -DPARAVIEW_BUILD_TESTING:BOOL=OFF
159
    -DCMAKE_INSTALL_LIBDIR:PATH=lib
160
    -DCMAKE_INSTALL_NAME_DIR:PATH=<INSTALL_DIR>/lib
161
    -DCMAKE_MACOSX_RPATH:BOOL=OFF
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
162
    -DPARAVIEW_PLUGIN_ENABLE_OpenVR:BOOL=${openvr_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
163
    -DPARAVIEW_BUILD_QT_GUI:BOOL=${qt5_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
164
    -DPARAVIEW_ENABLE_FFMPEG:BOOL=${ffmpeg_enabled}
165
    -DPARAVIEW_ENABLE_PYTHON:BOOL=${PARAVIEW_ENABLE_PYTHON}
166
    -DPARAVIEW_PYTHON_VERSION:STRING=2
Ben Boeckel's avatar
Ben Boeckel committed
167
168
    -DPARAVIEW_ENABLE_COSMOTOOLS:BOOL=${cosmotools_enabled}
    -DPARAVIEW_ENABLE_XDMF3:BOOL=${xdmf3_enabled}
169
    -DPARAVIEW_ENABLE_LAS:BOOL=${las_enabled}
170
    -DPARAVIEW_ENABLE_MOTIONFX:BOOL=${PARAVIEW_ENABLE_MOTIONFX}
Ben Boeckel's avatar
Ben Boeckel committed
171
    -DPARAVIEW_USE_MPI:BOOL=${mpi_enabled}
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
172
    -DPARAVIEW_ENABLE_VISITBRIDGE:BOOL=${visitbridge_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
173
    -DVISIT_BUILD_READER_Silo:BOOL=${silo_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
174
    -DVISIT_BUILD_READER_Boxlib3D:BOOL=${boxlib_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
175
176
    -DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=${paraview_install_development_files}
    -DPARAVIEW_FREEZE_PYTHON:BOOL=${PARAVIEW_FREEZE_PYTHON}
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
177
178
179
    -DVTK_MODULE_USE_EXTERNAL_VTK_netcdf:BOOL=${netcdf_enabled}
    -DVTK_MODULE_USE_EXTERNAL_VTK_freetype:BOOL=${freetype_enabled}
    -DVTK_MODULE_USE_EXTERNAL_VTK_hdf5:BOOL=${hdf5_enabled}
180
    -DHDF5_NO_FIND_PACKAGE_CONFIG_FILE:BOOL=ON
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
181
182
183
184
185
    -DVTK_MODULE_USE_EXTERNAL_VTK_libxml2:BOOL=${libxml2_enabled}
    -DVTK_MODULE_USE_EXTERNAL_VTK_png:BOOL=${png_enabled}
    -DVTK_MODULE_USE_EXTERNAL_VTK_zlib:BOOL=${zlib_enabled}
    -DVTK_MODULE_USE_EXTERNAL_VTK_expat:BOOL=${expat_enabled}
    -DVTK_MODULE_ENABLE_VTK_IOADIOS:BOOL=${adios_module_flag}
Ben Boeckel's avatar
Ben Boeckel committed
186
    -DVTK_SMP_IMPLEMENTATION_TYPE:STRING=${paraview_smp_backend}
187
    -DVTK_LEGACY_REMOVE:BOOL=ON
188
189
    -DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=${osmesa_enabled}
    -DVTK_OPENGL_HAS_EGL:BOOL=${egl_enabled}
190
    -DVTK_OPENGL_HAS_OSMESA:BOOL=${osmesa_enabled}
191
    -DVTK_USE_X:BOOL=${paraview_use_x}
Ben Boeckel's avatar
Ben Boeckel committed
192

193
    # mesa flags
194
195
    -DPARAVIEW_BUILD_MESA_LAUNCHER:BOOL=${mesa_enabled}
    -DPARAVIEW_MESA_LIBDIR:STRING=${paraview_mesa_libdir}
196

197
198
199
200
201
202
    # raytracing flags
    -DPARAVIEW_USE_RAYTRACING:BOOL=${paraview_use_raytracing}
    -DVTKOSPRAY_ENABLE_DENOISER:BOOL=${openimagedenoise_enabled}
    -DVTK_ENABLE_OSPRAY:BOOL=${ospray_enabled}
    -DVTK_ENABLE_VISRTX:BOOL=${visrtx_enabled}

203
    # IndeX
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
204
    -DPARAVIEW_PLUGIN_ENABLE_pvNVIDIAIndeX:BOOL=${nvidiaindex_enabled}
205

Ben Boeckel's avatar
Ben Boeckel committed
206
    # vrpn
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
207
208
    -DPARAVIEW_PLUGIN_ENABLE_VRPlugin:BOOL=${vrpn_enabled}
    -DPARAVIEW_PLUGIN_VRPlugin_USE_VRPN:BOOL=${vrpn_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
209

Robert Maynard's avatar
Robert Maynard committed
210
    # vtkm
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
211
    -DPARAVIEW_PLUGIN_ENABLE_VTKmFilters:BOOL=${vtkm_enabled}
Robert Maynard's avatar
Robert Maynard committed
212
    -DPARAVIEW_USE_VTKM:BOOL=${vtkm_enabled}
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
213
    -DVTK_VTKM_ENABLE_CUDA:BOOL=${paraview_enable_cuda}
Robert Maynard's avatar
Robert Maynard committed
214

215
    # Web
Ben Boeckel's avatar
Ben Boeckel committed
216
    -DPARAVIEW_ENABLE_WEB:BOOL=${paraviewweb_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
217

218
219
220
    # ParFlow
    -DPARAVIEW_PLUGIN_ENABLE_ParFlow:BOOL=${nlohmannjson_enabled}

Ben Boeckel's avatar
Ben Boeckel committed
221
222
223
224
225
226
227
228
229
230
    # add additional plugin directories
    -DPARAVIEW_EXTERNAL_PLUGIN_DIRS:STRING=${paraview_plugin_dirs}

    ${paraview_extra_cmake_options}

    ${PARAVIEW_EXTRA_CMAKE_ARGUMENTS})

if (DEFINED CMAKE_BUILD_TYPE_save)
  set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE_save}")
endif ()
231
232
233
234
235

if (paraview_install_development_files)
  find_program(SED_EXECUTABLE sed)
  mark_as_advanced(SED_EXECUTABLE)
  if (SED_EXECUTABLE)
236
    superbuild_project_add_step("fixup-cmake-paths"
237
      COMMAND "${CMAKE_COMMAND}"
Ben Boeckel's avatar
Ben Boeckel committed
238
239
240
              -Dinstall_location:PATH=<INSTALL_DIR>
              -Dparaview_version:STRING=${paraview_version}
              -P "${CMAKE_CURRENT_LIST_DIR}/scripts/paraview.fixupcmakepaths.cmake"
241
      COMMENT   "Fixing paths in generated CMake files for packaging."
242
243
244
245
      DEPENDEES install
      WORKING_DIRECTORY <INSTALL_DIR>)
  endif ()
endif ()
246

247
if (paraview_SOURCE_SELECTION STREQUAL "5.3.0")
248
249
  superbuild_apply_patch(paraview fix-benchmarks
    "Fix various issues with the shipped benchmark scripts")
250
251
  superbuild_apply_patch(paraview fix-vtkconfig-part1
    "Fix various issues with the VTKConfig.cmake (Part 1)")
252
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
253

254
255
256
257
258
if (paraview_SOURCE_SELECTION STREQUAL "5.5.0")
  superbuild_apply_patch(paraview fix-mpi4py
    "Fix issue with building VTK's mpi4py")
endif ()

259
260
261
if (paraview_SOURCE_SELECTION STREQUAL "5.6.0")
  superbuild_apply_patch(paraview fix-catalyst-adapter-deps
    "Fix issue with catalyst adapters and dependency search")
262
263
  superbuild_apply_patch(paraview fix-eye-dome-lighting
    "Fix eye dome lighting in parallel")
264
265
endif ()

Dan Lipsa's avatar
Dan Lipsa committed
266
267
268
269
270
if (WIN32 AND las_enabled)
  superbuild_append_flags(cxx_flags "-DBOOST_ALL_NO_LIB" PROJECT_ONLY)
endif()


Ben Boeckel's avatar
Ben Boeckel committed
271
272
273
274
if (APPLE)
  superbuild_append_flags(cxx_flags "-stdlib=libc++" PROJECT_ONLY)
  superbuild_append_flags(ld_flags "-stdlib=libc++" PROJECT_ONLY)
endif ()