paraview.cmake 7.75 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
24
25
26
endif()

set(paraview_visit_gmv ON)
if (osmesa_enabled OR egl_enabled)
  set(paraview_visit_gmv OFF)
Ben Boeckel's avatar
Ben Boeckel committed
27
28
29
30
endif ()

option(PARAVIEW_BUILD_WEB_DOCUMENTATION "Build documentation for the web" OFF)

Ben Boeckel's avatar
Ben Boeckel committed
31
32
33
34
35
36
set(paraview_all_plugins
  vortexfinder2)

if (superbuild_build_phase)
  get_property(paraview_plugins GLOBAL
    PROPERTY paraview_plugins)
37
38
  get_property(paraview_plugin_dirs_external GLOBAL
    PROPERTY paraview_plugin_dirs_external)
Ben Boeckel's avatar
Ben Boeckel committed
39

40
41
  set(paraview_plugin_dirs
    "${paraview_plugin_dirs_external}")
Ben Boeckel's avatar
Ben Boeckel committed
42
43
44
45
46
47
48
49
50
51
  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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

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 ()

70
71
72
73
74
set(paraview_enable_cuda "OFF")
if(vtkm_enabled AND cuda_enabled)
  set(paraview_enable_cuda "ON")
endif()

Ben Boeckel's avatar
Ben Boeckel committed
75
76
77
78
set(PARAVIEW_EXTERNAL_PROJECTS ""
  CACHE STRING "A list of projects for ParaView to depend on")
mark_as_advanced(PARAVIEW_EXTERNAL_PROJECTS)

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

81
82
83
84
set(paraviews_platform_dependencies)
if (UNIX)
  if (NOT APPLE)
    list(APPEND paraviews_platform_dependencies
Ben Boeckel's avatar
Ben Boeckel committed
85
      mesa osmesa egl
86

87
88
      boxlib

89
90
      # Needed for fonts to work properly.
      fontconfig)
91
92
  endif ()
  list(APPEND paraviews_platform_dependencies
Dan Lipsa's avatar
Dan Lipsa committed
93
    adios ffmpeg libxml2 freetype
94
95

    # For cosmotools
96
    genericio cosmotools)
97
98
endif ()

99
100
101
102
103
set(paraview_mesa_sb_available FALSE)
if (PARAVIEW_DEFAULT_SYSTEM_GL AND mesa_enabled)
  set(paraview_mesa_sb_available TRUE)
endif ()

Ken Martin's avatar
Ken Martin committed
104
105
if (WIN32)
  list(APPEND paraviews_platform_dependencies
Ben Boeckel's avatar
Ben Boeckel committed
106
    openvr)
Ken Martin's avatar
Ken Martin committed
107
108
endif ()

109
110
111
112
113
set(PARAVIEW_ENABLE_PYTHON ${python_enabled})
if (python_enabled AND USE_SYSTEM_python AND NOT python_FIND_LIBRARIES)
  set(PARAVIEW_ENABLE_PYTHON OFF)
endif()

Chuck Atkins's avatar
Chuck Atkins committed
114
115
116
if (expat_ENABLED)
  list(APPEND paraviews_platform_dependencies expat)
endif ()
117

Ben Boeckel's avatar
Ben Boeckel committed
118
superbuild_add_project(paraview
Ben Boeckel's avatar
Ben Boeckel committed
119
  DEBUGGABLE
Ben Boeckel's avatar
Ben Boeckel committed
120
121
  DEFAULT_ON
  DEPENDS_OPTIONAL
122
    cuda boost hdf5 matplotlib mpi numpy png
Dan Lipsa's avatar
Dan Lipsa committed
123
    python qt5 visitbridge zlib silo las
Robert Maynard's avatar
Robert Maynard committed
124
    xdmf3 ospray vrpn vtkm tbb netcdf
125
126
    paraviewgettingstartedguide
    paraviewtutorialdata paraviewweb
127
    paraviewpluginsexternal
Ben Boeckel's avatar
Ben Boeckel committed
128
    ${paraview_all_plugins}
129
    ${paraviews_platform_dependencies}
Ben Boeckel's avatar
Ben Boeckel committed
130
131
132
133
134
135
136
    ${PARAVIEW_EXTERNAL_PROJECTS}

  CMAKE_ARGS
    -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
    -DBUILD_TESTING:BOOL=OFF
    -DPARAVIEW_BUILD_PLUGIN_CoProcessingScriptGenerator:BOOL=ON
    -DPARAVIEW_BUILD_PLUGIN_EyeDomeLighting:BOOL=ON
Ken Martin's avatar
Ken Martin committed
137
    -DPARAVIEW_BUILD_PLUGIN_OpenVR:BOOL=${openvr_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
138
139
    -DPARAVIEW_BUILD_QT_GUI:BOOL=${qt5_enabled}
    -DPARAVIEW_ENABLE_QT_SUPPORT:BOOL=${qt5_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
140
    -DPARAVIEW_ENABLE_FFMPEG:BOOL=${ffmpeg_enabled}
141
    -DPARAVIEW_ENABLE_PYTHON:BOOL=${PARAVIEW_ENABLE_PYTHON}
Ben Boeckel's avatar
Ben Boeckel committed
142
143
    -DPARAVIEW_ENABLE_COSMOTOOLS:BOOL=${cosmotools_enabled}
    -DPARAVIEW_ENABLE_XDMF3:BOOL=${xdmf3_enabled}
144
    -DPARAVIEW_ENABLE_LAS:BOOL=${las_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
145
    -DPARAVIEW_USE_MPI:BOOL=${mpi_enabled}
146
    -DPARAVIEW_USE_OSPRAY:BOOL=${ospray_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
147
    -DPARAVIEW_USE_VISITBRIDGE:BOOL=${visitbridge_enabled}
148
149
    -DVISIT_BUILD_READER_CGNS:BOOL=OFF # force to off
    -DVISIT_BUILD_READER_GMV:BOOL=${paraview_visit_gmv}
Ben Boeckel's avatar
Ben Boeckel committed
150
    -DVISIT_BUILD_READER_Silo:BOOL=${silo_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
151
    -DVISIT_BUILD_READER_Boxlib3D:BOOL=${boxlib_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
152
153
154
155
    -DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=${paraview_install_development_files}
    -DPARAVIEW_ENABLE_MATPLOTLIB:BOOL=${matplotlib_enabled}
    -DPARAVIEW_FREEZE_PYTHON:BOOL=${PARAVIEW_FREEZE_PYTHON}
    -DVTK_USE_SYSTEM_NETCDF:BOOL=${netcdf_enabled}
156
    -DVTK_USE_SYSTEM_NETCDFCPP:BOOL=${netcdf_built_by_superbuild}
Ben Boeckel's avatar
Ben Boeckel committed
157
158
    -DVTK_USE_SYSTEM_FREETYPE:BOOL=${freetype_enabled}
    -DVTK_USE_SYSTEM_HDF5:BOOL=${hdf5_enabled}
159
    -DHDF5_NO_FIND_PACKAGE_CONFIG_FILE:BOOL=ON
Ben Boeckel's avatar
Ben Boeckel committed
160
161
162
    -DVTK_USE_SYSTEM_LIBXML2:BOOL=${libxml2_enabled}
    -DVTK_USE_SYSTEM_PNG:BOOL=${png_enabled}
    -DVTK_USE_SYSTEM_ZLIB:BOOL=${zlib_enabled}
Chuck Atkins's avatar
Chuck Atkins committed
163
    -DVTK_USE_SYSTEM_EXPAT:BOOL=${expat_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
164
165
    -DModule_vtkIOADIOS:BOOL=${adios_enabled}
    -DVTK_SMP_IMPLEMENTATION_TYPE:STRING=${paraview_smp_backend}
166
    -DVTK_LEGACY_REMOVE:BOOL=ON
167
168
    -DVTK_DEFAULT_RENDER_WINDOW_OFFSCREEN:BOOL=${osmesa_enabled}
    -DVTK_OPENGL_HAS_EGL:BOOL=${egl_enabled}
169
    -DVTK_OPENGL_HAS_OSMESA:BOOL=${osmesa_enabled}
170
    -DVTK_USE_X:BOOL=${paraview_use_x}
171
    -DVTK_USE_CXX11_FEATURES:BOOL=${cxx11_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
172

173
174
    # mesa flags
    -DPARAVIEW_WITH_SUPERBUILD_MESA:BOOL=${paraview_mesa_sb_available}
175
    -DPARAVIEW_WITH_SUPERBUILD_MESA_SWR:BOOL=${mesa_USE_SWR}
176

Ben Boeckel's avatar
Ben Boeckel committed
177
178
179
180
    # vrpn
    -DPARAVIEW_BUILD_PLUGIN_VRPlugin:BOOL=${vrpn_enabled}
    -DPARAVIEW_USE_VRPN:BOOL=${vrpn_enabled}

Robert Maynard's avatar
Robert Maynard committed
181
182
183
184
    # vtkm
    -DPARAVIEW_BUILD_PLUGIN_VTKmFilters:BOOL=${vtkm_enabled}
    -DPARAVIEW_USE_VTKM:BOOL=${vtkm_enabled}
    -DModule_vtkAcceleratorsVTKm:BOOL=${vtkm_enabled}
185
    -DVTKm_ENABLE_CUDA:BOOL=${paraview_enable_cuda}
Robert Maynard's avatar
Robert Maynard committed
186

187
    # Web
Ben Boeckel's avatar
Ben Boeckel committed
188
    -DPARAVIEW_ENABLE_WEB:BOOL=${paraviewweb_enabled}
Ben Boeckel's avatar
Ben Boeckel committed
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    -DPARAVIEW_BUILD_WEB_DOCUMENTATION:BOOL=${PARAVIEW_BUILD_WEB_DOCUMENTATION}

    # specify the apple app install prefix. No harm in specifying it for all
    # platforms.
    -DMACOSX_APP_INSTALL_PREFIX:PATH=<INSTALL_DIR>/Applications

    # 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 ()
205
206
207
208
209

if (paraview_install_development_files)
  find_program(SED_EXECUTABLE sed)
  mark_as_advanced(SED_EXECUTABLE)
  if (SED_EXECUTABLE)
210
    superbuild_project_add_step("fixup-cmake-paths"
211
      COMMAND "${CMAKE_COMMAND}"
Ben Boeckel's avatar
Ben Boeckel committed
212
213
214
              -Dinstall_location:PATH=<INSTALL_DIR>
              -Dparaview_version:STRING=${paraview_version}
              -P "${CMAKE_CURRENT_LIST_DIR}/scripts/paraview.fixupcmakepaths.cmake"
215
      COMMENT   "Fixing paths in generated CMake files for packaging."
216
217
218
219
      DEPENDEES install
      WORKING_DIRECTORY <INSTALL_DIR>)
  endif ()
endif ()
220

221
if (paraview_SOURCE_SELECTION STREQUAL "5.3.0")
222
223
  superbuild_apply_patch(paraview fix-benchmarks
    "Fix various issues with the shipped benchmark scripts")
224
225
  superbuild_apply_patch(paraview fix-vtkconfig-part1
    "Fix various issues with the VTKConfig.cmake (Part 1)")
226
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
227

Dan Lipsa's avatar
Dan Lipsa committed
228
229
230
231
232
if (WIN32 AND las_enabled)
  superbuild_append_flags(cxx_flags "-DBOOST_ALL_NO_LIB" PROJECT_ONLY)
endif()


Ben Boeckel's avatar
Ben Boeckel committed
233
234
235
236
if (APPLE)
  superbuild_append_flags(cxx_flags "-stdlib=libc++" PROJECT_ONLY)
  superbuild_append_flags(ld_flags "-stdlib=libc++" PROJECT_ONLY)
endif ()