CMakeLists.txt 10.3 KB
Newer Older
Ben Boeckel's avatar
Ben Boeckel committed
1
cmake_minimum_required(VERSION 3.6.1)
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.8.0"
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
    paraviewpluginsexternal
36
37
38
    python
    python2
    python3)
39
40
41
42
43

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

100
  if (UNIX)
101
    list(APPEND projects
102
      cosmotools
103
      ffi
104
      ffmpeg
Ben Boeckel's avatar
Ben Boeckel committed
105
      fortran
Joachim Pouderoux's avatar
Joachim Pouderoux committed
106
      gdal
107
      genericio
108
      lapack
109
      libxml2
Cory Quammen's avatar
Cory Quammen committed
110
      mili
Ben Boeckel's avatar
Ben Boeckel committed
111
      scipy)
112
113
114
115

    if (NOT APPLE)
      list(APPEND projects
        egl
Chuck Atkins's avatar
Chuck Atkins committed
116
        expat
117
        fontconfig
Chuck Atkins's avatar
Chuck Atkins committed
118
        glproto
119
        gperf
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
120
        launchers
121
        libfabric
122
123
124
        llvm
        mesa
        osmesa
Ben Boeckel's avatar
Ben Boeckel committed
125
        paraviewsdk
126
127
        socat
        utillinux)
128
129
130
131
    endif ()
  endif ()

  list(APPEND projects
132
    ospraymaterials
133
    paraviewgettingstartedguide
134
    paraviewtutorialdata)
135

136
  if (USE_NONFREE_COMPONENTS)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
137
    # add non-free projects here.
Ben Boeckel's avatar
Ben Boeckel committed
138
139
140
141
    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
142
143
        nvidiamdl
        nvidiaoptix)
Ben Boeckel's avatar
Ben Boeckel committed
144
145
146
147

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

151
152
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
153
      ftjam
Ken Martin's avatar
Ken Martin committed
154
      openvr
155
156
157
      pywin32)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
158
159
160
161
162
  if (WIN32 OR (UNIX AND NOT APPLE))
    list(APPEND projects
      nvidiaindex)
  endif ()

163
164
165
166
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
167

168
169
170
171
172
function (superbuild_sanity_check)
  if (NOT paraview_enabled AND NOT catalyst_enabled)
    message(WARNING "ParaView is disabled...")
  endif ()

173
174
175
176
177
178
179
  # 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 ()

180
  # Sanity check: Cannot have EGL and Qt enabled at the same time.
Ben Boeckel's avatar
Ben Boeckel committed
181
  if (egl_enabled AND qt5_enabled)
182
    message(SEND_ERROR "Cannot enable EGL and Qt at the same time.")
183
  endif ()
184
185
186
187

  # 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.")
188
189
  endif ()

190
191
192
193
194
  # 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 ()

195
  # Sanity check: Cannot have OSMesa and Qt enabled at the same time if we're building ParaView.
Ben Boeckel's avatar
Ben Boeckel committed
196
  if (osmesa_enabled AND qt5_enabled AND paraview_enabled)
197
198
199
200
201
202
203
204
    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
205
206
207
208
209
210
211
212
  # 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 ()
213
214
endfunction ()

215
216
217
function (superbuild_add_packaging)
  if (WIN32)
    set(generators
218
219
      ZIP
      NSIS)
220
221
222
223
224
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
Cory Quammen's avatar
Cory Quammen committed
225
226
      TGZ
      TXZ)
227
  endif ()
228
  list(GET generators 0 default_generator)
229

Ben Boeckel's avatar
Ben Boeckel committed
230
231
232
  if (USE_SYSTEM_qt5)
    list(APPEND superbuild_export_variables
      Qt5_DIR)
233
234
235
236
    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
237
  endif ()
238
239
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
240

241
242
243
244
  if (NOT DEFINED PARAVIEW_CATALYST_EDITION)
    set(PARAVIEW_CATALYST_EDITION Full)
  endif ()

245
246
247
248
249
250
  if (BUILD_SHARED_LIBS_paraview STREQUAL "<same>")
    set(paraview_is_shared "${BUILD_SHARED_LIBS}")
  else ()
    set(paraview_is_shared "${BUILD_SHARED_LIBS_paraview}")
  endif ()

251
252
  include(paraview.suffix)
  list(APPEND superbuild_export_variables
253
    mesa_USE_SWR
254
    mesa_SWR_ARCH
255
    nvidiaindex_SOURCE_SELECTION
256
    PARAVIEW_PACKAGE_SUFFIX
257
258
    PARAVIEW_CATALYST_EDITION
    paraview_is_shared)
Chuck Atkins's avatar
Chuck Atkins committed
259
260
261
262
263
264
265
266
267
268
269
270
271
272

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

274
275
276
277
278
279
280
281
  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 ()

282
283
  set(default_package)

284
285
  foreach (generator IN LISTS generators)
    if (paraview_enabled)
286
287
288
      if (NOT default_package)
        set(default_package paraview)
      endif ()
289
290
      superbuild_add_extra_package_test(paraview "${generator}"
        LABELS  "ParaView"
291
        TIMEOUT 6400)
292
293
    endif ()
  endforeach ()
Chuck Atkins's avatar
Chuck Atkins committed
294
295

  if (paraviewsdk_enabled)
296
    set(default_package paraviewsdk)
Chuck Atkins's avatar
Chuck Atkins committed
297
298
299
    superbuild_add_extra_package_test(paraviewsdk "TGZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Cory Quammen's avatar
Cory Quammen committed
300
301
302
    superbuild_add_extra_package_test(paraviewsdk "TXZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Chuck Atkins's avatar
Chuck Atkins committed
303
  endif ()
304
305
306
307

  if (default_package)
    superbuild_enable_install_target("${default_package}/${default_generator}")
  endif ()
308
endfunction ()
309

310
311
312
313
function (superbuild_add_tests)
  add_subdirectory("${CMAKE_SOURCE_DIR}/tests" "${CMAKE_BINARY_DIR}/tests")
endfunction ()

314
315
316
317
318
319
320
321
322
323
324
325
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

326
set(boost_libraries
327
328
  atomic
  chrono
329
  date_time
Ben Boeckel's avatar
Ben Boeckel committed
330
331
332
  filesystem
  iostreams
  program_options
333
  regex
334
335
  system
  thread)
Dan Lipsa's avatar
Dan Lipsa committed
336
337
set(boost_extra_options
  "-sNO_BZIP2=1")
338
339
340

list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
341
list(APPEND superbuild_ctest_custom_files
342
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake")
343
344
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
345

346
347
348
# set the default arguments used for "git clone"
set(_git_clone_arguments_default --progress)

349
350
351
# set the default for cxx11 to be enabled for this project
set(_superbuild_default_cxx11 ON)

352
353
354
# Enable nlohmann_json by default
set(_superbuild_default_nlohmannjson ON)

Ben Boeckel's avatar
Ben Boeckel committed
355
356
# set the default for qt5 to be 5.9
set(_superbuild_qt5_default_selection "5.9")
Ben Boeckel's avatar
Ben Boeckel committed
357

358
359
360
# Force qt SVG support, so ParaView can use SVG icons
set(qt5_ENABLE_SVG ON CACHE INTERNAL "ParaView requires SVG support")

361
362
363
364
365
# 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
366
option(BUILD_SHARED_LIBS "Build shared or static libs" ON)
367
368
if (NOT BUILD_SHARED_LIBS AND _superbuild_no_static_everywhere)
  message(FATAL_ERROR
369
370
    "Setting BUILD_SHARED_LIBS=OFF is almost certainly what you don't want. "
    "Maybe you want the `BUILD_SHARED_LIBS_paraview=OFF` option?")
371
372
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
373
374
375
376
# Build UCS4 binaries by default. This is more compatible with Linux
# distributions.
set(_python_unicode_default "UCS4")

377
378
379
380
381
382
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 ()

383
384
385
386
387
388
389
# 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()

390
add_subdirectory(superbuild)