CMakeLists.txt 11.6 KB
Newer Older
1
cmake_minimum_required(VERSION 3.12)
2

Ben Boeckel's avatar
Ben Boeckel committed
3
project(paraview-superbuild)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
4

5
6
7
list(INSERT CMAKE_MODULE_PATH 0
  "${CMAKE_CURRENT_LIST_DIR}/cmake")

Ben Boeckel's avatar
Ben Boeckel committed
8
9
macro (superbuild_setup_variables)
  include(SuperbuildVersionMacros)
10
  if (paraview_SOURCE_SELECTION STREQUAL "git")
11
12
    # Assuming master; just use the latest version, but let the user set their
    # own version in case it is actually a branch from some other version.
13
    set(PARAVIEW_VERSION_DEFAULT "5.9.1-RC2"
14
15
16
17
18
19
20
      CACHE STRING "The default version of ParaView to use if it cannot be detected")
    mark_as_advanced(PARAVIEW_VERSION_DEFAULT)
    set(paraview_default_version "${PARAVIEW_VERSION_DEFAULT}")
  elseif (paraview_SOURCE_SELECTION STREQUAL "source")
    # If it is a git repo, we'll get it that way, otherwise we will look at the
    # `version.txt` in the checkout.
    set(paraview_default_version "")
21
  else ()
22
23
    # The selection is the version number; use it.
    set(paraview_default_version "${paraview_SOURCE_SELECTION}")
24
  endif()
25
  superbuild_set_version_variables(paraview "${paraview_default_version}" "paraview-version.cmake" "version.txt")
Ben Boeckel's avatar
Ben Boeckel committed
26
27
28
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
endmacro ()

29
30
31
32
33
34
function (superbuild_find_projects var)
  include(ParaViewSuperbuildMacros)

  set(projects
    cxx11
    paraview
35
36
    python
    python3)
37
38
39
40
41

  option(USE_NONFREE_COMPONENTS "Enable the non-free parts of the superbuild" OFF)
  mark_as_advanced(USE_NONFREE_COMPONENTS)

  list(APPEND projects
Chuck Atkins's avatar
Chuck Atkins committed
42
    adios2
43
44
    boost
    bzip2
Ben Boeckel's avatar
Ben Boeckel committed
45
    cuda
46
    freetype
Joachim Pouderoux's avatar
Joachim Pouderoux committed
47
    gdal
48
    hdf5
Ben Boeckel's avatar
Ben Boeckel committed
49
    h5py
50
    ispc
Ben Boeckel's avatar
Ben Boeckel committed
51
    las
52
    lookingglass
53
54
    matplotlib
    mpi
Ben Boeckel's avatar
Ben Boeckel committed
55
    netcdf
56
    nlohmannjson
57
    numpy
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
58
    openpmd
59
    paraviewweb
60
    paraviewwebglance
Sebastien Jourdain's avatar
Sebastien Jourdain committed
61
    paraviewweblite
62
    paraviewwebdivvy
63
    paraviewwebflow
Ben Boeckel's avatar
Ben Boeckel committed
64
    paraviewwebvisualizer
65
    png
66
    protobuf
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
67
    pybind11
68
    pythonattrs
69
70
    pythonautobahn
    pythonconstantly
71
    pythoncycler
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
72
    pythoncython
73
    pythondateutil
74
75
    pythonhyperlink
    pythonincremental
76
    pythonkiwisolver
77
    pythonmako
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
78
    pythonpandas
Ben Boeckel's avatar
Ben Boeckel committed
79
    pythonpkgconfig
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
80
    pythonpygments
81
    pythonpyparsing
Ben Boeckel's avatar
Ben Boeckel committed
82
    pythonsetuptools
83
84
85
86
    pythonsix
    pythontwisted
    pythontxaio
    pythonwslink
Ben Boeckel's avatar
Ben Boeckel committed
87
    pythonzope
88
    pythonzopeinterface
89
    pytz
90
91
92
93
94
95
    qt5
    silo
    szip
    visitbridge
    vortexfinder2
    vrpn
Robert Maynard's avatar
Robert Maynard committed
96
    vtkm
97
    xdmf3
Chuck Atkins's avatar
Chuck Atkins committed
98
    zfp
99
100
    zlib)

101
102
  # These projects only support Intel processors.
  set(tbb_supported OFF)
Ben Boeckel's avatar
Ben Boeckel committed
103
104
  if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
      CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
105
    set(tbb_supported ON)
Ben Boeckel's avatar
Ben Boeckel committed
106
107
108
    # These are publicly available, but are behind logins or license
    # acceptances. Rehosted internally at Kitware for build machines.
    list(APPEND projects
109
110
111
112
113
114
115
116
117
118
      tbb) # x86_64-only

    # TBB-using projects
    list(APPEND projects
      embree
      openimagedenoise
      openvkl
      ospray
      ospraymodulempi
      rkcommon)
Ben Boeckel's avatar
Ben Boeckel committed
119
  endif ()
120
121
  set_property(GLOBAL PROPERTY
    superbuild_tbb_supported "${tbb_supported}")
Ben Boeckel's avatar
Ben Boeckel committed
122

123
  if (UNIX)
124
    list(APPEND projects
125
      cosmotools
126
      ffi
127
      ffmpeg
Caitlin Ross's avatar
Caitlin Ross committed
128
      fides
Ben Boeckel's avatar
Ben Boeckel committed
129
      fortran
Joachim Pouderoux's avatar
Joachim Pouderoux committed
130
      gdal
131
      genericio
132
      gmsh
133
      lapack
134
      libxml2
Cory Quammen's avatar
Cory Quammen committed
135
      mili
136
      pkgconf
137
      rapidjson
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
138
      scipy
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
139
      surfacetrackercut
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
140
      sqlite)
141
142
143
144

    if (NOT APPLE)
      list(APPEND projects
        egl
Chuck Atkins's avatar
Chuck Atkins committed
145
        expat
146
        fontconfig
Chuck Atkins's avatar
Chuck Atkins committed
147
        glproto
148
        gperf
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
149
        launchers
150
        libfabric
151
152
153
        llvm
        mesa
        osmesa
Ben Boeckel's avatar
Ben Boeckel committed
154
        paraviewsdk
155
156
        socat
        utillinux)
157
158
159
160
    endif ()
  endif ()

  list(APPEND projects
161
    ospraymaterials
162
    paraviewgettingstartedguide
163
    paraviewtutorialdata)
164

165
  if (USE_NONFREE_COMPONENTS)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
166
    # add non-free projects here.
Ben Boeckel's avatar
Ben Boeckel committed
167
168
169
170
    if (WIN32 OR (UNIX AND NOT APPLE))
      # These are publicly available, but are behind logins or license
      # acceptances. Rehosted internally at Kitware for build machines.
      list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
171
172
        nvidiamdl
        nvidiaoptix)
Ben Boeckel's avatar
Ben Boeckel committed
173
174
175
176

      # These are open source, but require closed SDKs.
      list(APPEND projects
        visrtx)
Ben Boeckel's avatar
Ben Boeckel committed
177
    endif ()
178
  endif ()
179

180
181
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
182
      ftjam
Ken Martin's avatar
Ken Martin committed
183
      openvr
184
185
186
      pywin32)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
187
188
189
190
191
  if (WIN32 OR (UNIX AND NOT APPLE))
    list(APPEND projects
      nvidiaindex)
  endif ()

192
193
194
195
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
196

197
198
199
200
201
function (superbuild_sanity_check)
  if (NOT paraview_enabled AND NOT catalyst_enabled)
    message(WARNING "ParaView is disabled...")
  endif ()

202
203
204
205
206
207
208
  # Sanity check: Cannot have paraview and have cxx11 disabled.
  if (NOT cxx11_enabled AND paraview_enabled)
    #While ParaView doesn't depend on cxx11 it needs to make sure that
    #other projects that optionally depend on it are built with cxx11
    message(SEND_ERROR "Cannot disable cxx11 when paraview is enabled.")
  endif ()

209
  # Sanity check: Cannot have EGL and Qt enabled at the same time.
Ben Boeckel's avatar
Ben Boeckel committed
210
  if (egl_enabled AND qt5_enabled)
211
    message(SEND_ERROR "Cannot enable EGL and Qt at the same time.")
212
  endif ()
213
214
215
216

  # Sanity check: Cannot have EGL and Mesa at the same time.
  if (egl_enabled AND mesa_enabled)
    message(SEND_ERROR "Cannot enable EGL and Mesa at the same time.")
217
218
  endif ()

219
220
221
222
223
  # Sanity check: Cannot have EGL and OSMesa at the same time.
  if (egl_enabled AND osmesa_enabled)
    message(SEND_ERROR "Cannot enable EGL and OSMesa at the same time.")
  endif ()

224
  # Sanity check: Cannot have OSMesa and Qt enabled at the same time if we're building ParaView.
Ben Boeckel's avatar
Ben Boeckel committed
225
  if (osmesa_enabled AND qt5_enabled AND paraview_enabled)
226
227
228
229
230
231
232
233
    message(SEND_ERROR "Cannot enable OSMesa and Qt at the same time.")
  endif ()

  # Sanity check: Cannot have OSMesa and Mesa at the same time.
  if (osmesa_enabled AND mesa_enabled)
    message(SEND_ERROR "Cannot enable OSMesa and Mesa at the same time.")
  endif ()

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
234
235
236
237
238
239
240
241
  # Sanity check: report cases where it doesn't make any sense to enable launchers.
  if (launchers_enabled AND NOT (mesa_enabled OR mpi_enabled))
    message(SEND_ERROR "Launchers cannot be enabled since neither MPI or MESA is enabled.")
  endif ()

  if (launchers_enabled AND mpi_enabled AND USE_SYSTEM_mpi AND NOT mesa_enabled)
    message(SEND_ERROR "Launchers cannot be enabled since MESA is not enabled and USE_SYSTEM_mpi is ON.")
  endif ()
242
243
endfunction ()

244
245
246
function (superbuild_add_packaging)
  if (WIN32)
    set(generators
247
248
      ZIP
      NSIS)
249
250
251
252
253
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
254
      TGZ)
255
  endif ()
256
  list(GET generators 0 default_generator)
257

258
  if (qt5_enabled AND (USE_SYSTEM_qt5 OR APPLE OR WIN32))
Ben Boeckel's avatar
Ben Boeckel committed
259
260
    list(APPEND superbuild_export_variables
      Qt5_DIR)
261
262
263
264
    find_package(Qt5 QUIET REQUIRED COMPONENTS Core)
    set(qt5_version "${Qt5Core_VERSION_MAJOR}.${Qt5Core_VERSION_MINOR}")
  else ()
    set(qt5_version "${qt5_SOURCE_SELECTION}")
Ben Boeckel's avatar
Ben Boeckel committed
265
  endif ()
266
267
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
268

269
270
271
272
  if (NOT DEFINED PARAVIEW_CATALYST_EDITION)
    set(PARAVIEW_CATALYST_EDITION Full)
  endif ()

273
274
275
276
277
278
  if (BUILD_SHARED_LIBS_paraview STREQUAL "<same>")
    set(paraview_is_shared "${BUILD_SHARED_LIBS}")
  else ()
    set(paraview_is_shared "${BUILD_SHARED_LIBS_paraview}")
  endif ()

279
280
  include(paraview.suffix)
  list(APPEND superbuild_export_variables
281
    mesa_USE_SWR
282
    mesa_SWR_ARCH
283
    nvidiaindex_SOURCE_SELECTION
284
    PARAVIEW_PACKAGE_SUFFIX
285
286
    PARAVIEW_CATALYST_EDITION
    paraview_is_shared)
Chuck Atkins's avatar
Chuck Atkins committed
287
288
289
290
291
292
293
294
295
296
297
298
299
300

  if (paraview_enabled)
    set(PARAVIEW_PACKAGE_FILE_NAME ""
      CACHE STRING "If set, overrides the generated filename for the package")
    list(APPEND superbuild_export_variables
      PARAVIEW_PACKAGE_FILE_NAME)
  endif ()

  if (paraviewsdk_enabled)
    set(PARAVIEWSDK_PACKAGE_FILE_NAME ""
      CACHE STRING "If set, overrides the generated filename for the package")
    list(APPEND superbuild_export_variables
      PARAVIEWSDK_PACKAGE_FILE_NAME)
  endif ()
301

302
303
304
305
306
307
308
309
310
311
312
  if (zfp_enabled)
    # ZFP will look for OpenMP and enable it if OPENMP_FOUND is set to
    # true. Do the same here and export a variable to the packaging step
    # if it is found.
    find_package(OpenMP COMPONENTS C)
    if (OPENMP_FOUND)
      set(CMAKE_INSTALL_OPENMP_LIBRARIES 1 CACHE BOOL "Install OpenMP runtime libraries")
      list(APPEND superbuild_export_variables CMAKE_INSTALL_OPENMP_LIBRARIES)
    endif()
  endif()

313
314
315
316
317
318
319
320
  set(paraview_PLUGINS_AUTOLOAD ""
    CACHE STRING "List of plugins to autoload")
  foreach (paraview_plugin IN LISTS paraview_PLUGINS_AUTOLOAD)
    set("paraview_plugin_${paraview_plugin}_auto_load" 1)
    list(APPEND superbuild_export_variables
      "paraview_plugin_${paraview_plugin}_auto_load")
  endforeach ()

321
322
  set(default_package)

323
324
  foreach (generator IN LISTS generators)
    if (paraview_enabled)
325
326
327
      if (NOT default_package)
        set(default_package paraview)
      endif ()
328
329
      superbuild_add_extra_package_test(paraview "${generator}"
        LABELS  "ParaView"
330
        TIMEOUT 6400)
331
332
    endif ()
  endforeach ()
Chuck Atkins's avatar
Chuck Atkins committed
333
334

  if (paraviewsdk_enabled)
335
    set(default_package paraviewsdk)
Chuck Atkins's avatar
Chuck Atkins committed
336
337
338
    superbuild_add_extra_package_test(paraviewsdk "TGZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Cory Quammen's avatar
Cory Quammen committed
339
340
341
    superbuild_add_extra_package_test(paraviewsdk "TXZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Chuck Atkins's avatar
Chuck Atkins committed
342
  endif ()
343
344
345
346

  if (default_package)
    superbuild_enable_install_target("${default_package}/${default_generator}")
  endif ()
347
endfunction ()
348

349
350
351
352
function (superbuild_add_tests)
  add_subdirectory("${CMAKE_SOURCE_DIR}/tests" "${CMAKE_BINARY_DIR}/tests")
endfunction ()

353
354
355
356
357
358
359
360
361
362
363
364
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

365
set(boost_libraries
366
367
  atomic
  chrono
368
  date_time
Ben Boeckel's avatar
Ben Boeckel committed
369
370
371
  filesystem
  iostreams
  program_options
372
  regex
373
374
  system
  thread)
Dan Lipsa's avatar
Dan Lipsa committed
375
376
set(boost_extra_options
  "-sNO_BZIP2=1")
377
378
379

list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
380
list(APPEND superbuild_ctest_custom_files
381
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake")
382
383
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
384

385
386
387
# set the default arguments used for "git clone"
set(_git_clone_arguments_default --progress)

388
389
390
# set the default for cxx11 to be enabled for this project
set(_superbuild_default_cxx11 ON)

391
392
393
# Enable nlohmann_json by default
set(_superbuild_default_nlohmannjson ON)

394
395
# set the default for qt5 to be 5.12
set(_superbuild_qt5_default_selection "5.12")
Ben Boeckel's avatar
Ben Boeckel committed
396

397
398
399
# Force qt SVG support, so ParaView can use SVG icons
set(qt5_ENABLE_SVG ON CACHE INTERNAL "ParaView requires SVG support")

400
401
402
403
404
# ParaView's superbuild does not support static-everywhere builds. But let
# people around the check if they want it.
if (NOT PARAVIEW_I_WANT_EVERYTHING_STATIC)
  set(_superbuild_no_static_everywhere ON)
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
405
option(BUILD_SHARED_LIBS "Build shared or static libs" ON)
406
407
if (NOT BUILD_SHARED_LIBS AND _superbuild_no_static_everywhere)
  message(FATAL_ERROR
408
409
    "Setting BUILD_SHARED_LIBS=OFF is almost certainly what you don't want. "
    "Maybe you want the `BUILD_SHARED_LIBS_paraview=OFF` option?")
410
411
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
412
413
414
415
# Build UCS4 binaries by default. This is more compatible with Linux
# distributions.
set(_python_unicode_default "UCS4")

416
417
418
419
# The projects end up with "errors" in their output that CDash ends up seeing
# and thinking things went wrong.
set(_superbuild_suppress_matplotlib_output ON)

420
421
422
423
424
425
if (NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/superbuild/CMakeLists.txt")
  message(FATAL_ERROR "It appears as though the superbuild infrastructure "
                      "is missing; did you forget to do `git submodule init` "
                      "and `git submodule update`?")
endif ()

426
427
428
429
430
431
432
# Warn about deprecated PARAVIEW_DEFAULT_SYSTEM_GL.
if (DEFINED PARAVIEW_DEFAULT_SYSTEM_GL)
  message(WARNING "The 'PARAVIEW_DEFAULT_SYSTEM_GL' variable is deprecated. "
    "Use the 'launchers' project instead.")
  set(_superbuild_default_launchers "${PARAVIEW_DEFAULT_SYSTEM_GL}")
endif()

433
add_subdirectory(superbuild)