CMakeLists.txt 31.5 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
#==========================================================================
#
#     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.
#
#==========================================================================
31
cmake_minimum_required(VERSION 3.12...3.16 FATAL_ERROR)
32
33
project(ParaView)

34
# Disallow in-source build
Ben Boeckel's avatar
Ben Boeckel committed
35
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
36
  message(FATAL_ERROR
Ben Boeckel's avatar
Ben Boeckel committed
37
38
39
    "ParaView requires an out-of-source build. Please create a separate "
    "binary directory and run CMake there.")
endif ()
40

41
42
#------------------------------------------------------------------------------
# Set a default build type if none was specified
Ben Boeckel's avatar
Ben Boeckel committed
43
44
45
get_property(generator_is_multi_config GLOBAL
  PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT CMAKE_BUILD_TYPE AND NOT generator_is_multi_config)
46
47
48
  message(STATUS "Setting build type to 'Debug' as none was specified.")
  set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
  # Set the possible values of build type for cmake-gui
Ben Boeckel's avatar
Ben Boeckel committed
49
50
51
52
  set_property(CACHE CMAKE_BUILD_TYPE
    PROPERTY
      STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
53

54
# Set up our directory structure for output libraries and binaries
55
include(GNUInstallDirs)
Ben Boeckel's avatar
Ben Boeckel committed
56
57
58
59
60
61
62
63
64
65
if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
  set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
endif ()
if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
endif ()
if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
  set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
endif ()

66
67
68
69
70
71
72
73
set(CMAKE_INSTALL_LICENSEDIR ""
  CACHE PATH "License files (DATAROOTDIR/licenses/${CMAKE_PROJECT_NAME}")
mark_as_advanced(CMAKE_INSTALL_LICENSEDIR)
if (NOT CMAKE_INSTALL_LICENSEDIR)
  set(CMAKE_INSTALL_LICENSEDIR
    "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
74
set(paraview_cmake_dir "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
75
set(vtk_cmake_dir "${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake")
76
77
78
79
80
if (NOT IS_DIRECTORY "${vtk_cmake_dir}")
  message(FATAL_ERROR
    "Failed to find the VTK CMake directory. Did you forget to initialize the "
    "submodule? (git submodule update --init --recursive)")
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
81
list(APPEND CMAKE_MODULE_PATH
82
83
  "${paraview_cmake_dir}"
  "${vtk_cmake_dir}")
Ben Boeckel's avatar
Ben Boeckel committed
84
85
include(ParaViewServerManager)
include(ParaViewTesting)
Ben Boeckel's avatar
Ben Boeckel committed
86
include(ParaViewClient)
Ben Boeckel's avatar
Ben Boeckel committed
87
include(ParaViewPlugin)
88
include(ParaViewPluginDebugging)
Ben Boeckel's avatar
Ben Boeckel committed
89
90
include(vtkModuleWrapClientServer)
include(CTest)
Ben Boeckel's avatar
Ben Boeckel committed
91
92
93
set_property(CACHE BUILD_TESTING
  PROPERTY
    TYPE INTERNAL)
94
95
96
97
98
99
100

include(vtkCompilerChecks)
include(vtkCompilerPlatformFlags)
include(vtkCompilerExtraFlags)
include(vtkInitializeBuildType)
include(vtkSupportMacros)

101
102
include(CMakeDependentOption)
include(ParaViewOptions)
103
include(ParaViewMigrations)
104

105
106
107
108
109
#------------------------------------------------------------------------------
# Choose static or shared libraries.
set(BUILD_SHARED_LIBS "${PARAVIEW_BUILD_SHARED_LIBS}")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
110
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
111
112
113
114

#------------------------------------------------------------------------------
# Protect against a stampede of static links at the same time.
if (NOT PARAVIEW_BUILD_SHARED_LIBS)
Ben Boeckel's avatar
Ben Boeckel committed
115
  set(CMAKE_JOB_POOL_LINK static_exe_link)
116
  set_property(GLOBAL APPEND PROPERTY
Ben Boeckel's avatar
Ben Boeckel committed
117
    JOB_POOLS "${CMAKE_JOB_POOL_LINK}=1")
118
119
endif ()

120
121
122
123
124
125
#-----------------------------------------------------------------------------
# Does VTK require support for 64 bit file systems
include(CheckCXXSourceRuns)
file(READ "${vtk_cmake_dir}/vtkRequireLargeFilesSupport.cxx"
  VTK_REQUIRE_LARGE_FILE_SUPPORT_FILE)
check_cxx_source_runs("${VTK_REQUIRE_LARGE_FILE_SUPPORT_FILE}"
126
  CMAKE_REQUIRE_LARGE_FILE_SUPPORT)
127
128
129
130
set(VTK_REQUIRE_LARGE_FILE_SUPPORT ${CMAKE_REQUIRE_LARGE_FILE_SUPPORT})

#-----------------------------------------------------------------------------
# Provide compatibility options.
131
132
set(VTK_LEGACY_REMOVE ${PARAVIEW_BUILD_LEGACY_REMOVE})
set(VTK_LEGACY_SILENT ${PARAVIEW_BUILD_LEGACY_SILENT})
Ben Boeckel's avatar
Ben Boeckel committed
133
134
135
136

# Setup external data. this will automatically download the test data and
# baseline files to the build tree and set PARAVIEW_DATA_ROOT.
include(ParaViewExternalData)
137

Ben Boeckel's avatar
Ben Boeckel committed
138
find_package(Git QUIET)
139
include(ParaViewDetermineVersion)
140

141
142
143
144
#------------------------------------------------------------------------------
# Setup ParaView Environment
#------------------------------------------------------------------------------
# Determine ParaView Source Version
145
146
147
148
# Hardcoded version variables are readin from a separate file. This makes it
# easier to have a script to update version numbers automatically.
file(STRINGS version.txt version_txt)
extract_version_components("${version_txt}" "PARAVIEW")
Ben Boeckel's avatar
Ben Boeckel committed
149
determine_version("${CMAKE_CURRENT_SOURCE_DIR}" "${GIT_EXECUTABLE}" "PARAVIEW")
Alexander Neundorf's avatar
   
Alexander Neundorf committed
150

151
152
153
# Setting this ensures that "make install" will leave rpaths to external
# libraries (not part of the build-tree e.g. Qt, ffmpeg, etc.) intact on
# "make install". This ensures that one can install a version of ParaView on the
154
155
156
# build machine without any issues. If this not desired, simply specify
# CMAKE_INSTALL_RPATH_USE_LINK_PATH when configuring Paraview and
# "make install" will strip all rpaths, which is default behavior.
157
158
159
if (NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
Alexander Neundorf's avatar
   
Alexander Neundorf committed
160

161
162
163
164
165
166
if(PARAVIEW_USE_CUDA)
  # This needs to be a top level flag as enable_language needs
  # to be called from CMake entry point for variables to have
  # the correct scope.
  enable_language(CUDA)
endif()
167

168
169
170
171
172
set(BUILD_TESTING OFF)
if (PARAVIEW_BUILD_TESTING)
  set(BUILD_TESTING ON)
endif ()

173
if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
174
175
176
177
178
179
180
181
182
183
184
185
186
  if (DEFINED PARAVIEW_PYTHON_VERSION)
    if (PARAVIEW_PYTHON_VERSION STREQUAL "3")
      message(DEPRECATION
        "Python 2 is no longer supported. Ignoring the explicit "
        "`PARAVIEW_PYTHON_VERSION=3` request as it is the only valid value "
        "now.")
    else ()
      message(FATAL_ERROR
        "Python 2 is no longer supported. Please either set "
        "`PARAVIEW_PYTHON_VERSION=3` or remove the option completely.")
    endif ()
    unset(PARAVIEW_PYTHON_VERSION)
    unset(PARAVIEW_PYTHON_VERSION CACHE)
Ben Boeckel's avatar
Ben Boeckel committed
187
  endif ()
Ben Boeckel's avatar
Ben Boeckel committed
188
  set(VTK_PYTHON_VERSION 3)
Ben Boeckel's avatar
Ben Boeckel committed
189
endif ()
190

191
if (PARAVIEW_USE_PYTHON AND PARAVIEW_BUILD_TESTING)
192
193
194
  # testing needs Python interpreter i.e. `PYTHON_EXECUTABLE` without which
  # our `find_python_module` checks to determine which tests to add or exclude
  # will fail. We find it here.
195
  find_package(Python3 3.3 QUIET COMPONENTS Interpreter)
196
  include(FindPythonModules)
197
198
endif()

199
200
201
set(paraview_features_needing_remote_modules
  PARAVIEW_ENABLE_MOMENTINVARIANTS
  PARAVIEW_ENABLE_LOOKINGGLASS)
Dan Lipsa's avatar
Dan Lipsa committed
202
set(use_vtk_remote_modules OFF)
203
204
205
206
207
208
209
foreach (option IN LISTS paraview_features_needing_remote_modules)
  if (${option})
    set(use_vtk_remote_modules ON)
    message(STATUS "Enabling remote modules for ${option}")
    break()
  endif ()
endforeach ()
Dan Lipsa's avatar
Dan Lipsa committed
210

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
211
212
if (PARAVIEW_USE_FORTRAN)
  enable_language(Fortran OPTIONAL)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
213
214
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
215
216
217
218
219
220
221
if (PARAVIEW_USE_EXTERNAL_VTK)
  find_package(VTK REQUIRED)
else ()
  list(APPEND CMAKE_MODULE_PATH
    "${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake")
  include(vtkCMakeBackports)
  include(vtkModule)
222
  include(vtkModuleDebugging)
Ben Boeckel's avatar
Ben Boeckel committed
223
224
225
226
  include(vtkEncodeString)
  include(vtkObjectFactory)
  include(vtkExternalData)
  include(vtkVersion)
Mathieu Westphal's avatar
Mathieu Westphal committed
227
  include(VTKDetermineVersion)
Ben Boeckel's avatar
Ben Boeckel committed
228
229
  set(VTK_VERSION
      "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
Mathieu Westphal's avatar
Mathieu Westphal committed
230
  determine_version("${CMAKE_CURRENT_SOURCE_DIR}/VTK" "${GIT_EXECUTABLE}" "VTK")
Ben Boeckel's avatar
Ben Boeckel committed
231

232
  if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
233
234
235
    include(vtkModuleWrapPython)
  endif ()
endif ()
236

Ben Boeckel's avatar
Ben Boeckel committed
237
238
239
240
set_property(GLOBAL
  PROPERTY
    "_vtk_module_autoinit_include" "\"vtkAutoInit.h\"")

241
242
# Note that the way that this flag gets used, it only has an effect on the
# initial configuration.
243
244
245
246
247
set(_paraview_plugins_default OFF)
if (PARAVIEW_BUILD_EDITION STREQUAL "CANONICAL")
  set(_paraview_plugins_default ON)
endif()
option(PARAVIEW_PLUGINS_DEFAULT "Default state for ParaView plugins" "${_paraview_plugins_default}")
248
mark_as_advanced(PARAVIEW_PLUGINS_DEFAULT)
249
250
set(paraview_default_plugins
  AcceleratedAlgorithms
251
  AnalyzeNIfTIReaderWriter
252
  ArrowGlyph
253
  BagPlotViewsAndFilters
254
  CDIReader
255
  Datamine
256
257
258
  DigitalRockPhysics
  EULATestPlugin
  EmbossingRepresentations
259
  EyeDomeLighting
260
  ExplicitStructuredGrid
261
  FlipBookPlugin
262
  GenericIOReader
263
  GeodesicMeasurement
264
  GMVReader
265
  HyperTreeGridADR
266
  LagrangianParticleTracker
267
  LegacyExodusReader
268
  Moments
269
  MooseXfemClip
270
  NetCDFTimeAnnotationPlugin
271
  NodeEditor
272
  NonOrthogonalSource
273
  PacMan
274
  PanoramicProjectionView
275
  # ParFlow - Because of dependency to nlohmann_json
Dan Lipsa's avatar
Dan Lipsa committed
276
  SaveStateAndScreenshot
277
  SLACTools
278
  StreamLinesRepresentation
279
  StreamingParticles
280
  SurfaceLIC
281
  ThickenLayeredCells
282
283
  VTKmFilters
  pvblot)
284
foreach (paraview_default_plugin IN LISTS paraview_default_plugins)
285
  set("_paraview_plugin_default_${paraview_default_plugin}" "${PARAVIEW_PLUGINS_DEFAULT}")
286
287
endforeach ()

Ben Boeckel's avatar
Ben Boeckel committed
288
289
290
291
292
293
294
295
set(paraview_plugin_directories
  "${CMAKE_CURRENT_SOURCE_DIR}/Plugins")
paraview_plugin_find_plugins(paraview_plugin_files ${paraview_plugin_directories})
paraview_plugin_scan(
  PLUGIN_FILES      ${paraview_plugin_files}
  PROVIDES_PLUGINS  paraview_plugins
  REQUIRES_MODULES  paraview_plugin_required_modules)

296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
set(paraview_client_directories
  "${CMAKE_CURRENT_SOURCE_DIR}/Clients"
  "${CMAKE_CURRENT_SOURCE_DIR}/Adaptors")
vtk_module_find_modules(paraview_client_module_files ${paraview_client_directories})
vtk_module_find_kits(paraview_client_kit_files ${paraview_client_directories})
vtk_module_scan(
  MODULE_FILES        ${paraview_client_module_files}
  KIT_FILES           ${paraview_client_kit_files}
  REQUEST_MODULES     ${paraview_client_requested_modules}
  REJECT_MODULES      ${paraview_client_rejected_modules}
  PROVIDES_MODULES    paraview_client_modules
  PROVIDES_KITS       paraview_client_kits
  REQUIRES_MODULES    paraview_client_required_modules
  UNRECOGNIZED_MODULES paraview_client_unrecognized_modules
  WANT_BY_DEFAULT     "${PARAVIEW_BUILD_ALL_MODULES}"
  ENABLE_TESTS        "${PARAVIEW_BUILD_TESTING}")

Ben Boeckel's avatar
Ben Boeckel committed
313
set(paraview_source_directories
314
  "${CMAKE_CURRENT_SOURCE_DIR}/Kits"
Ben Boeckel's avatar
Ben Boeckel committed
315
  "${CMAKE_CURRENT_SOURCE_DIR}/Qt"
316
317
318
  "${CMAKE_CURRENT_SOURCE_DIR}/VTKExtensions"
  "${CMAKE_CURRENT_SOURCE_DIR}/Web"
  "${CMAKE_CURRENT_SOURCE_DIR}/Remoting"
Ben Boeckel's avatar
Ben Boeckel committed
319
  "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty"
320
  "${CMAKE_CURRENT_SOURCE_DIR}/Utilities")
Ben Boeckel's avatar
Ben Boeckel committed
321
322
323
324
325
326
327
vtk_module_find_modules(paraview_module_files ${paraview_source_directories})
vtk_module_find_kits(paraview_kit_files ${paraview_source_directories})
vtk_module_scan(
  MODULE_FILES        ${paraview_module_files}
  KIT_FILES           ${paraview_kit_files}
  REQUEST_MODULES     ${paraview_requested_modules}
                      ${paraview_plugin_required_modules}
328
                      ${paraview_client_required_modules}
Ben Boeckel's avatar
Ben Boeckel committed
329
330
331
332
333
  REJECT_MODULES      ${paraview_rejected_modules}
  PROVIDES_MODULES    paraview_modules
  PROVIDES_KITS       paraview_kits
  REQUIRES_MODULES    paraview_required_modules
  UNRECOGNIZED_MODULES paraview_unrecognized_modules
334
  WANT_BY_DEFAULT     "${PARAVIEW_BUILD_ALL_MODULES}"
335
  ENABLE_TESTS        "${PARAVIEW_BUILD_TESTING}")
Ben Boeckel's avatar
Ben Boeckel committed
336
337
338
339
340
341
342
343

set(paraview_unrecognized_paraview_modules)
foreach (paraview_module IN LISTS paraview_unrecognized_modules)
  if (paraview_module MATCHES "ParaView::")
    list(APPEND paraview_unrecognized_paraview_modules
      "${paraview_module}")
  endif ()
endforeach ()
344

345
346
347
348
if (paraview_unrecognized_paraview_modules)
  list(REMOVE_ITEM paraview_unrecognized_paraview_modules ${paraview_rejected_modules})
endif()

Ben Boeckel's avatar
Ben Boeckel committed
349
350
351
352
353
if (paraview_unrecognized_paraview_modules)
  message(FATAL_ERROR
    "The following modules were requested or required, but not found: "
    "${paraview_unrecognized_paraview_modules}.")
endif ()
354

355
356
357
358
359
360
361
option(PARAVIEW_VERSIONED_INSTALL "Install artifacts with versioned names." ON)
mark_as_advanced(PARAVIEW_VERSIONED_INSTALL)
set(paraview_version_suffix "")
if (PARAVIEW_VERSIONED_INSTALL)
  set(paraview_version_suffix "-${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
362
set(paraview_cmake_destination
363
364
365
366
367
368
369
370
371
372
373
374
  "${CMAKE_INSTALL_LIBDIR}/cmake/paraview${paraview_version_suffix}")

set(PARAVIEW_CUSTOM_LIBRARY_SUFFIX "<DEFAULT>"
  CACHE STRING "Custom library file name suffix (defaults to the version number)")
mark_as_advanced(PARAVIEW_CUSTOM_LIBRARY_SUFFIX)
if (PARAVIEW_CUSTOM_LIBRARY_SUFFIX STREQUAL "<DEFAULT>")
  if (PARAVIEW_VERSIONED_INSTALL)
    set(PARAVIEW_CUSTOM_LIBRARY_SUFFIX "pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}")
  else ()
    set(PARAVIEW_CUSTOM_LIBRARY_SUFFIX "")
  endif ()
endif ()
375

376
377
378
# Search for dependent libraries beside
set(_paraview_CMAKE_INSTALL_RPATH_save
  "${CMAKE_INSTALL_RPATH}")
379
380
381
382
383
384
385
if (APPLE)
  list(APPEND CMAKE_INSTALL_RPATH
    "@loader_path")
elseif (UNIX)
  list(APPEND CMAKE_INSTALL_RPATH
    "$ORIGIN")
endif ()
386

Ben Boeckel's avatar
Ben Boeckel committed
387
388
389
390
391
392
if (PARAVIEW_USE_EXTERNAL_VTK)
  if (paraview_required_modules OR paraview_unrecognized_modules)
    message(FATAL_ERROR
      "The following modules were requested or required, but not found: "
      "${paraview_required_modules};${paraview_unrecognized_modules}.")
  endif ()
393

394
  if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
395
396
397
    find_package(Python3 3.3 QUIET REQUIRED COMPONENTS Interpreter)
    set(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}")
    set(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}")
398
399
400
    if (NOT PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
      vtk_module_python_default_destination(PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
401
402
403
  endif ()
else ()
  set(vtk_requested_modules)
404
405
406
407
  foreach (vtk_module IN LISTS
                paraview_requested_modules
                paraview_plugin_required_modules
                paraview_client_required_modules)
Ben Boeckel's avatar
Ben Boeckel committed
408
409
410
411
412
413
414
415
416
417
418
419
420
421
    if (vtk_module MATCHES "ParaView::")
      continue ()
    endif ()
    list(APPEND vtk_requested_modules
      "${vtk_module}")
  endforeach ()
  set(vtk_rejected_modules)
  foreach (vtk_module IN LISTS paraview_rejected_modules)
    if (vtk_module MATCHES "ParaView::")
      continue ()
    endif ()
    list(APPEND vtk_rejected_modules
      "${vtk_module}")
  endforeach ()
422

423
424
425
  set(vtk_enable_tests "OFF")
  if (PARAVIEW_BUILD_VTK_TESTING)
    set(vtk_enable_tests "${PARAVIEW_BUILD_TESTING}")
426
427
428
    # Needed for `rtImageTest.py` tests to work. See note in `vtkModuleTesting`
    # about this.
    set(VTK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/VTK")
429
430
  endif ()

431
432
433
  # Forward shared library setting to VTK.
  set(VTK_BUILD_SHARED_LIBS "${PARAVIEW_BUILD_SHARED_LIBS}")

434
  # Forward Python option to VTK.
435
  set(VTK_WRAP_PYTHON "${PARAVIEW_USE_PYTHON}")
436

437
438
  # Forward MPI option to VTK.
  set(VTK_USE_MPI "${PARAVIEW_USE_MPI}")
439
440
  set(VTK_SERIAL_TESTS_USE_MPIEXEC "${PARAVIEW_SERIAL_TESTS_USE_MPIEXEC}")

441
442
  # Forward CUDA option to VTK
  set(VTK_USE_CUDA "${PARAVIEW_USE_CUDA}")
443
444
  # Forward Memkind option to VTK.
  set(VTK_USE_MEMKIND "${PARAVIEW_USE_MEMKIND}")
445

446
  # Forward logging option to VTK.
447
  set(VTK_ENABLE_LOGGING ON)
448

Dan Lipsa's avatar
Dan Lipsa committed
449
450
  if (use_vtk_remote_modules)
    if (PARAVIEW_ENABLE_MOMENTINVARIANTS)
451
      set(VTK_MODULE_ENABLE_VTK_MomentInvariants WANT)
Dan Lipsa's avatar
Dan Lipsa committed
452
    endif()
453
454
455
    if (PARAVIEW_ENABLE_LOOKINGGLASS)
      set(VTK_MODULE_ENABLE_VTK_RenderingLookingGlass WANT)
    endif()
Dan Lipsa's avatar
Dan Lipsa committed
456
457
458
459
460
461
462
463
    # include the Remote module
    include("${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake/vtkDownload.cmake")
    # TODO: remove this after changing in vtkModuleRemote.cmake:160
    # "${VTK_SOURCE_DIR}/Remote/${_name}" to "${CMAKE_CURRENT_LIST_DIR}/${_name}"
    set(VTK_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/VTK")
    add_subdirectory(VTK/Remote)
  endif()

464
465
466
467
468
469
470
471
472
473
474
475
  # Set up these variables now so that modules may acess them
  if (NOT PARAVIEW_USE_EXTERNAL_VTK AND PARAVIEW_INSTALL_DEVELOPMENT_FILES)
    set(vtk_cmake_dir
      "${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake")
    set(vtk_cmake_destination
      "${paraview_cmake_destination}/vtk")
    set(vtk_cmake_build_dir
      "${CMAKE_CURRENT_BINARY_DIR}/${vtk_cmake_destination}")
    set(VTK_RELOCATABLE_INSTALL
      "${PARAVIEW_RELOCATABLE_INSTALL}")
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
476
477
  vtk_module_find_modules(vtk_module_files "${CMAKE_CURRENT_SOURCE_DIR}/VTK")
  vtk_module_find_kits(vtk_kit_files "${CMAKE_CURRENT_SOURCE_DIR}/VTK")
478
479
480
  # Exclude VTK's examples.
  list(FILTER vtk_module_files EXCLUDE REGEX "/Examples/")
  list(FILTER vtk_kit_files EXCLUDE REGEX "/Examples/")
Ben Boeckel's avatar
Ben Boeckel committed
481
482
483
484
485
486
487
488
489
490
491
  vtk_module_scan(
    MODULE_FILES        ${vtk_module_files}
    KIT_FILES           ${vtk_kit_files}
    REQUEST_MODULES     ${vtk_requested_modules}
                        ${paraview_required_modules}
    REJECT_MODULES      ${vtk_rejected_modules}
    PROVIDES_MODULES    vtk_modules
    PROVIDES_KITS       vtk_kits
    REQUIRES_MODULES    vtk_required_modules
    UNRECOGNIZED_MODULES vtk_unrecognized_modules
    WANT_BY_DEFAULT     OFF
Ben Boeckel's avatar
Ben Boeckel committed
492
    ENABLE_TESTS        "${vtk_enable_tests}")
Ben Boeckel's avatar
Ben Boeckel committed
493

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
494
495
496
  if (vtk_unrecognized_modules AND vtk_rejected_modules)
    list(REMOVE_ITEM vtk_unrecognized_modules ${vtk_rejected_modules})
  endif()
Ben Boeckel's avatar
Ben Boeckel committed
497
498
499
500
501
  if (vtk_required_modules OR vtk_unrecognized_modules)
    message(FATAL_ERROR
      "The following modules were requested or required, but not found: "
      "${vtk_required_modules};${vtk_unrecognized_modules}.")
  endif ()
502

503
  if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
504
505
506
    find_package("Python3" 3.3 QUIET REQUIRED COMPONENTS Interpreter)
    set(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}")
    set(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}")
507
508
509
    if (NOT PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
      vtk_module_python_default_destination(PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
510
511
    set(VTK_PYTHON_SITE_PACKAGES_SUFFIX "${PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX}")
  endif ()
512

Ben Boeckel's avatar
Ben Boeckel committed
513
514
515
516
  set(VTK_BUILD_QT_DESIGNER_PLUGIN OFF)
  set(VTK_INSTALL_PYTHON_EXES OFF)

  cmake_dependent_option(VTK_NO_PYTHON_THREADS "Disable Python Threads support" ON
517
    "PARAVIEW_USE_PYTHON" OFF)
Ben Boeckel's avatar
Ben Boeckel committed
518
519
520
521
522
  mark_as_advanced(VTK_NO_PYTHON_THREADS)
  cmake_dependent_option(VTK_PYTHON_FULL_THREADSAFE "Wrap all Python calls with the GIL" ON
    "NOT VTK_NO_PYTHON_THREADS" OFF)
  mark_as_advanced(VTK_PYTHON_FULL_THREADSAFE)
  cmake_dependent_option(VTK_USE_TK "Build VTK with Tk support" OFF
523
    "PARAVIEW_USE_PYTHON" OFF)
524

525
526
527
528
529
  cmake_dependent_option(PARAVIEW_WINDOWS_PYTHON_DEBUGGABLE
    "Explicitly indicate that the Python library is debuggable" OFF
    "WIN32;PARAVIEW_USE_PYTHON" OFF)
  mark_as_advanced(PARAVIEW_WINDOWS_PYTHON_DEBUGGABLE)
  set(VTK_WINDOWS_PYTHON_DEBUGGABLE ${PARAVIEW_WINDOWS_PYTHON_DEBUGGABLE})
Ben Boeckel's avatar
Ben Boeckel committed
530
531
532
533
534
535

  vtk_module_build(
    MODULES             ${vtk_modules}
    KITS                ${vtk_kits}
    PACKAGE             VTK
    INSTALL_EXPORT      VTK
536
    INSTALL_HEADERS     "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
537
    HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/paraview${paraview_version_suffix}"
Ben Boeckel's avatar
Ben Boeckel committed
538
    CMAKE_DESTINATION   "${paraview_cmake_destination}/vtk"
539
    LICENSE_DESTINATION "${CMAKE_INSTALL_LICENSEDIR}"
Ben Boeckel's avatar
Ben Boeckel committed
540
    HIERARCHY_DESTINATION "${CMAKE_INSTALL_LIBDIR}/vtk/hierarchy/${CMAKE_PROJECT_NAME}"
541
    LIBRARY_NAME_SUFFIX "${PARAVIEW_CUSTOM_LIBRARY_SUFFIX}"
Ben Boeckel's avatar
Ben Boeckel committed
542
543
544
    VERSION             "${PARAVIEW_VERSION}"
    SOVERSION           "1"
    TEST_DATA_TARGET    ParaViewData
545
546
    BUILD_WITH_KITS     "${PARAVIEW_BUILD_WITH_KITS}"
    USE_EXTERNAL        "${PARAVIEW_BUILD_WITH_EXTERNAL}"
547
    ENABLE_WRAPPING     ON
Ben Boeckel's avatar
Ben Boeckel committed
548
    TEST_INPUT_DATA_DIRECTORY   "${CMAKE_CURRENT_SOURCE_DIR}/VTK/Testing"
549
    TEST_OUTPUT_DATA_DIRECTORY  "${CMAKE_CURRENT_BINARY_DIR}/ExternalData/VTK/Testing")
Ben Boeckel's avatar
Ben Boeckel committed
550

551
552
  install(
    FILES       "${CMAKE_CURRENT_SOURCE_DIR}/VTK/Copyright.txt"
553
    DESTINATION "${CMAKE_INSTALL_LICENSEDIR}/VTK"
554
    COMPONENT   "license")
Ben Boeckel's avatar
Ben Boeckel committed
555
endif ()
556

557
558
559
560
561
562
563
# Determine whether the ParaView GUI will be built or not.
set(paraview_will_be_built 0)
if (PARAVIEW_USE_QT AND
    (WIN32 OR VTK_USE_X OR VTK_USE_COCOA))
  set(paraview_will_be_built 1)
endif ()

564
565
566
567
if (NOT PARAVIEW_USE_EXTERNAL_VTK AND PARAVIEW_INSTALL_DEVELOPMENT_FILES)
  include("${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake/vtkInstallCMakePackage.cmake")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
568
569
570
571
572
573
574
575
576
577
578
579
580
set(paraview_test_data_directory_input
  "${CMAKE_CURRENT_SOURCE_DIR}/Testing")
set(paraview_test_data_directory_output
  "${CMAKE_CURRENT_BINARY_DIR}/ExternalData")
set(_paraview_add_tests_default_data_directory
  "${paraview_test_data_directory_output}")
set(_paraview_add_tests_default_test_data_target
  "ParaViewData")

vtk_module_build(
  MODULES             ${paraview_modules}
  KITS                ${paraview_kits}
  INSTALL_EXPORT      ParaView
581
  INSTALL_HEADERS     "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
582
  HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/paraview${paraview_version_suffix}"
Ben Boeckel's avatar
Ben Boeckel committed
583
  CMAKE_DESTINATION   "${paraview_cmake_destination}"
584
  LICENSE_DESTINATION "${CMAKE_INSTALL_LICENSEDIR}"
Ben Boeckel's avatar
Ben Boeckel committed
585
  HIERARCHY_DESTINATION "${CMAKE_INSTALL_LIBDIR}/vtk/hierarchy/${CMAKE_PROJECT_NAME}"
586
  LIBRARY_NAME_SUFFIX "${PARAVIEW_CUSTOM_LIBRARY_SUFFIX}"
Ben Boeckel's avatar
Ben Boeckel committed
587
588
589
  VERSION             "${PARAVIEW_VERSION}"
  SOVERSION           "1"
  TEST_DATA_TARGET    ParaViewData
590
591
  BUILD_WITH_KITS     "${PARAVIEW_BUILD_WITH_KITS}"
  USE_EXTERNAL        "${PARAVIEW_BUILD_WITH_EXTERNAL}"
Ben Boeckel's avatar
Ben Boeckel committed
592
593
594
  TEST_INPUT_DATA_DIRECTORY   "${paraview_test_data_directory_input}"
  TEST_OUTPUT_DATA_DIRECTORY  "${paraview_test_data_directory_output}")

595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
vtk_module_build(
  MODULES             ${paraview_client_modules}
  KITS                ${paraview_client_kits}
  PACKAGE             ParaViewClients
  INSTALL_EXPORT      ParaViewClients
  INSTALL_HEADERS     "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
  HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/paraview${paraview_version_suffix}"
  CMAKE_DESTINATION   "${paraview_cmake_destination}"
  LICENSE_DESTINATION "${CMAKE_INSTALL_LICENSEDIR}"
  HIERARCHY_DESTINATION "${CMAKE_INSTALL_LIBDIR}/vtk/hierarchy/${CMAKE_PROJECT_NAME}"
  LIBRARY_NAME_SUFFIX "${PARAVIEW_CUSTOM_LIBRARY_SUFFIX}"
  VERSION             "${PARAVIEW_VERSION}"
  SOVERSION           "1"
  TEST_DATA_TARGET    ParaViewData
  BUILD_WITH_KITS     "${PARAVIEW_BUILD_WITH_KITS}"
  USE_EXTERNAL        "${PARAVIEW_BUILD_WITH_EXTERNAL}"
  TEST_INPUT_DATA_DIRECTORY   "${paraview_test_data_directory_input}"
  TEST_OUTPUT_DATA_DIRECTORY  "${paraview_test_data_directory_output}")

614
615
include(vtkModuleJson)
vtk_module_json(
616
  MODULES ${vtk_modules}
617
618
  OUTPUT "vtk-modules.json")
vtk_module_json(
619
  MODULES ${paraview_modules}
620
  OUTPUT "paraview-modules.json")
621
622
623
vtk_module_json(
  MODULES ${paraview_client_modules}
  OUTPUT "paraview-client-modules.json")
624

625
626
list(LENGTH vtk_modules vtk_modules_len)
list(LENGTH paraview_modules paraview_modules_len)
627
628
list(LENGTH paraview_client_modules paraview_client_modules_len)
message(STATUS "Enabled modules: VTK(${vtk_modules_len}), ParaView(${paraview_modules_len} + ${paraview_client_modules_len})")
629

630
631
632
633
634
635
636
637
638
639
640
set(autoload_plugins)
foreach (paraview_plugin IN LISTS paraview_plugins)
  option("PARAVIEW_PLUGIN_AUTOLOAD_${paraview_plugin}" "Autoload the ${paraview_plugin} plugin" OFF)
  mark_as_advanced("PARAVIEW_PLUGIN_AUTOLOAD_${paraview_plugin}")

  if (PARAVIEW_PLUGIN_AUTOLOAD_${paraview_plugin})
    list(APPEND autoload_plugins
      "${paraview_plugin}")
  endif ()
endforeach ()

Ben Boeckel's avatar
Ben Boeckel committed
641
paraview_plugin_build(
642
  HEADERS_DESTINATION   "${CMAKE_INSTALL_INCLUDEDIR}/paraview${paraview_version_suffix}"
643
  RUNTIME_DESTINATION   "${CMAKE_INSTALL_BINDIR}"
Ben Boeckel's avatar
Ben Boeckel committed
644
  LIBRARY_DESTINATION   "${CMAKE_INSTALL_LIBDIR}"
645
  LIBRARY_SUBDIRECTORY  "paraview${paraview_version_suffix}/plugins"
646
  CMAKE_DESTINATION     "${paraview_cmake_destination}"
647
  PLUGINS_FILE_NAME "paraview.plugins.xml"
648
649
  TARGET            ParaView::paraview_plugins
  INSTALL_EXPORT    ParaViewPlugins
650
  INSTALL_HEADERS   "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
651
652
  TARGET_COMPONENT  "development"
  PLUGINS_COMPONENT "plugins"
653
654
  PLUGINS ${paraview_plugins}
  AUTOLOAD ${autoload_plugins})
Ben Boeckel's avatar
Ben Boeckel committed
655

656
657
658
set(CMAKE_INSTALL_RPATH
  "${_paraview_CMAKE_INSTALL_RPATH_save}")

Ben Boeckel's avatar
Ben Boeckel committed
659
vtk_module_wrap_client_server(
660
661
  MODULES   ${paraview_client_modules}
            ${paraview_modules}
Ben Boeckel's avatar
Ben Boeckel committed
662
663
664
665
666
667
668
            ${vtk_modules}
  TARGET    paraview_client_server
  INSTALL_EXPORT ParaView)

paraview_server_manager_process(
  MODULES   ${paraview_modules}
            ${vtk_modules}
Ben Boeckel's avatar
Ben Boeckel committed
669
  TARGET    paraview_server_manager
670
671
  XML_FILES paraview_server_manager_files
  INSTALL_EXPORT ParaView)
672

673
if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
674
675
676
677
678
679
  if (PARAVIEW_USE_EXTERNAL_VTK)
    # TODO: Check if VTK is already wrapped in Python.
    # Error out?
  else ()
    vtk_module_wrap_python(
      MODULES         ${vtk_modules}
680
      INSTALL_EXPORT  VTKPython
681
      INSTALL_HEADERS "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
Ben Boeckel's avatar
Ben Boeckel committed
682
683
684
      PYTHON_PACKAGE  "vtkmodules"
      MODULE_DESTINATION  "${PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX}"
      CMAKE_DESTINATION   "${paraview_cmake_destination}/vtk"
685
      LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
686
      USE_DEBUG_SUFFIX    "${PARAVIEW_WINDOWS_PYTHON_DEBUGGABLE}"
Ben Boeckel's avatar
Ben Boeckel committed
687
688
689
690
      WRAPPED_MODULES vtk_python_wrapped_modules
      TARGET          VTK::vtkpythonmodules)

    add_subdirectory(VTK/Wrapping/Python)
691

692
693
694
695
696
697
698
699
700
701
702
703
    if (PARAVIEW_INSTALL_DEVELOPMENT_FILES)
      export(
        EXPORT    VTKPython
        NAMESPACE VTK::
        FILE      "${CMAKE_BINARY_DIR}/${paraview_cmake_destination}/vtk/VTKPython-targets.cmake")
      install(
        EXPORT      VTKPython
        NAMESPACE   VTK::
        FILE        VTKPython-targets.cmake
        DESTINATION "${paraview_cmake_destination}/vtk"
        COMPONENT   "development")
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
704
  endif ()
705

706
707
708
709
710
711
712
713
714
  get_property(vtk_required_python_modules GLOBAL
    PROPERTY  vtk_required_python_modules)
  if (vtk_required_python_modules)
    list(REMOVE_DUPLICATES vtk_required_python_modules)
  endif ()
  string(REPLACE ";" "\n" vtk_required_python_modules "${vtk_required_python_modules}")
  file(WRITE "${CMAKE_BINARY_DIR}/requirements.txt"
    "${vtk_required_python_modules}\n")

Ben Boeckel's avatar
Ben Boeckel committed
715
716
  vtk_module_wrap_python(
    MODULES         ${paraview_modules}
717
                    ${paraview_client_modules}
718
    INSTALL_EXPORT  ParaViewPython
719
    INSTALL_HEADERS "${PARAVIEW_INSTALL_DEVELOPMENT_FILES}"
Ben Boeckel's avatar
Ben Boeckel committed
720
721
722
    PYTHON_PACKAGE  "paraview.modules"
    MODULE_DESTINATION  "${PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX}"
    CMAKE_DESTINATION   "${paraview_cmake_destination}"
723
    LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
724
    USE_DEBUG_SUFFIX    "${PARAVIEW_WINDOWS_PYTHON_DEBUGGABLE}"
Ben Boeckel's avatar
Ben Boeckel committed
725
    WRAPPED_MODULES paraview_python_wrapped_modules
726
727
    TARGET          ParaView::pvpythonmodules
    DEPENDS         VTK::vtkpythonmodules)
728

729
730
731
732
733
734
735
736
737
738
739
740
  if (PARAVIEW_INSTALL_DEVELOPMENT_FILES)
    export(
      EXPORT    ParaViewPython
      NAMESPACE ParaView::
      FILE      "${CMAKE_BINARY_DIR}/${paraview_cmake_destination}/ParaViewPython-targets.cmake")
    install(
      EXPORT      ParaViewPython
      NAMESPACE   ParaView::
      FILE        ParaViewPython-targets.cmake
      DESTINATION "${paraview_cmake_destination}"
      COMPONENT   "development")
  endif ()
Ben Boeckel's avatar
Ben Boeckel committed
741
endif ()
742

Ben Boeckel's avatar
Ben Boeckel committed
743
744
745
746
747
748
if (PARAVIEW_ENABLE_WEB)
  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/Web/package.json.in"
    "${CMAKE_CURRENT_BINARY_DIR}/package.json"
    @ONLY)
endif ()
749

750
add_subdirectory(Clients)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
751

752
if (PARAVIEW_USE_PYTHON)
Ben Boeckel's avatar
Ben Boeckel committed
753
754
  add_subdirectory(Wrapping/Python)
endif ()
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
755

Ben Boeckel's avatar
Ben Boeckel committed
756
757
758
759
760
761
762
if (NOT PARAVIEW_USE_EXTERNAL_VTK)
  # Configure the CTestCustom.cmake file for exclusions.
  configure_file(
    "${CMAKE_CURRENT_SOURCE_DIR}/VTK/CMake/CTestCustom.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/VTK/CTestCustom.cmake"
    @ONLY)
endif ()
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
763
764

# Configure the CTestCustom.cmake file for exclusions.
Ben Boeckel's avatar
Ben Boeckel committed
765
766
767
768
configure_file(
  "${paraview_cmake_dir}/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake"
  @ONLY)
769
770

ExternalData_Add_Target(ParaViewData)
Ben Boeckel's avatar
Ben Boeckel committed
771

772
773
774
775
776
if (PARAVIEW_INSTALL_DEVELOPMENT_FILES)
  set(paraview_cmake_build_dir
    "${CMAKE_CURRENT_BINARY_DIR}/${paraview_cmake_destination}")
  include("${CMAKE_CURRENT_SOURCE_DIR}/CMake/ParaViewInstallCMakePackage.cmake")
endif ()
777
778
779
780
781
782

set(is_git FALSE)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
  set(is_git TRUE)
endif ()

783
if (NOT WIN32 AND is_git AND Git_FOUND AND NOT GIT_VERSION_STRING VERSION_LESS "2.18.0")
784
785
786
787
788
789
790
  set(source_all)
  if (PARAVIEW_SOURCE_TARBALL_TARGETS)
    set(source_all ALL)
  endif ()

  add_custom_target(paraview-source ${source_all})
  foreach (format tgz txz zip)
791
    add_custom_target("paraview-source-${format}" ${source_all}
792
793
794
795
796
      COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/Maintenance/create_tarballs.bash"
              "--${format}"
      WORKING_DIRECTORY
              "${CMAKE_CURRENT_BINARY_DIR}"
      COMMENT "Creating source tarball in ${format} format")
797
798
    add_dependencies("paraview-source-${format}"
      ParaViewData)
799
800
801
    add_dependencies(paraview-source
      "paraview-source-${format}")
  endforeach ()
802
803
804
805
806
  # This is a hack.  Git version 2.17 does NOT like running these in parallel and
  # reports that a lockfile is already locked.  In order for the build to succeed,
  # force these to run in serial.
  add_dependencies(paraview-source-tgz paraview-source-txz)
  add_dependencies(paraview-source-txz paraview-source-zip)
807
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
808
809
810
811
812
813
814
815
816

# This is the directory under which all generated docs, such as Doxygen and
# Sphinx generated docs, are placed.
if (NOT PARAVIEW_GENERATED_DOCUMENTATION_OUTPUT_DIRECTORY)
  set(PARAVIEW_GENERATED_DOCUMENTATION_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/doc")
endif ()

#-----------------------------------------------------------------------------
# Build doxygen documentation.
817
if (PARAVIEW_BUILD_DEVELOPER_DOCUMENTATION)
Ben Boeckel's avatar
Ben Boeckel committed
818
819
820
821
822
823
824
825
826
827
828
  add_subdirectory(Utilities/Doxygen)
  add_subdirectory(Utilities/Sphinx)
  add_subdirectory(Documentation)
endif()

#------------------------------------------------------------------------------
# Test to check install tree
#------------------------------------------------------------------------------
if (BUILD_TESTING AND PARAVIEW_INSTALL_DEVELOPMENT_FILES)
  add_test( NAME pv.TestDevelopmentInstall
    COMMAND ${CMAKE_COMMAND}
829
    -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
Ben Boeckel's avatar
Ben Boeckel committed
830
831
832
833
    -DPARAVIEW_BINARY_DIR:PATH=${CMAKE_BINARY_DIR}
    -DPARAVIEW_INSTALL_DIR:PATH=${CMAKE_INSTALL_PREFIX}
    -DPARAVIEW_SOURCE_DIR:PATH=${CMAKE_SOURCE_DIR}
    -DPARAVIEW_TEST_DIR:PATH=${CMAKE_BINARY_DIR}/Testing/Temporary
834
    -DPARAVIEW_CMAKE_DESTINATION:STRING=${paraview_cmake_destination}
835
    -DPARAVIEW_BINDIR:STRING=${CMAKE_INSTALL_BINDIR}
836
    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
837
838
839
    -DCMAKE_GENERATOR:STRING=${CMAKE_GENERATOR}
    -DCMAKE_GENERATOR_PLATFORM:STRING=${CMAKE_GENERATOR_PLATFORM}
    -DCMAKE_GENERATOR_TOOLSET:STRING=${CMAKE_GENERATOR_TOOLSET}
Ben Boeckel's avatar
Ben Boeckel committed
840
841
    -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ParaViewTestInstall.cmake)
  set_tests_properties(pv.TestDevelopmentInstall PROPERTIES
842
    LABELS "paraview"
843
844
845
    ENVIRONMENT "DESTDIR=${CMAKE_BINARY_DIR}/test-install"
    # 10 minutes should be enough time.
    TIMEOUT 600)
Ben Boeckel's avatar
Ben Boeckel committed
846
847
848
endif()
#------------------------------------------------------------------------------

849
850
851
install(
  FILES       "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt"
              "${CMAKE_CURRENT_SOURCE_DIR}/License_v1.2.txt"
852
  DESTINATION "${CMAKE_INSTALL_LICENSEDIR}"
853
854
  COMPONENT   "license")

Ben Boeckel's avatar
Ben Boeckel committed
855
#-----------------------------------------------------------------------------
856
if (PARAVIEW_BUILD_EXAMPLES)
857
858
  add_subdirectory(Examples)
endif ()