CMakeLists.txt 9.02 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.6.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
39
40
41
42
43
    python)

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

  list(APPEND projects
    boost
    bzip2
Ben Boeckel's avatar
Ben Boeckel committed
44
    cuda
David E. DeMarle's avatar
David E. DeMarle committed
45
    embree
46
47
48
    freetype
    hdf5
    ispc
Ben Boeckel's avatar
Ben Boeckel committed
49
    lapack
Ben Boeckel's avatar
Ben Boeckel committed
50
    las
51
52
    matplotlib
    mpi
Ben Boeckel's avatar
Ben Boeckel committed
53
    netcdf
54
    numpy
55
    ospray
56
    openimagedenoise
57
    paraviewweb
58
    paraviewwebglance
Sebastien Jourdain's avatar
Sebastien Jourdain committed
59
    paraviewweblite
60
    paraviewwebdivvy
Ben Boeckel's avatar
Ben Boeckel committed
61
    paraviewwebvisualizer
62
    png
63
64
    pythonautobahn
    pythonconstantly
65
66
    pythoncycler
    pythondateutil
67
68
    pythonhyperlink
    pythonincremental
69
    pythonmako
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
70
    pythonpygments
71
    pythonpyparsing
Ben Boeckel's avatar
Ben Boeckel committed
72
    pythonsetuptools
73
74
75
76
    pythonsix
    pythontwisted
    pythontxaio
    pythonwslink
Ben Boeckel's avatar
Ben Boeckel committed
77
    pythonzope
78
    pythonzopeinterface
79
    pytz
80
81
82
83
84
85
86
    qt5
    silo
    szip
    tbb
    visitbridge
    vortexfinder2
    vrpn
Robert Maynard's avatar
Robert Maynard committed
87
    vtkm
88
89
90
    xdmf3
    zlib)

91
  if (UNIX)
92
93
    list(APPEND projects
      adios
94
      cosmotools
95
      ffmpeg
Ben Boeckel's avatar
Ben Boeckel committed
96
      fortran
97
      genericio
98
      libxml2
Ben Boeckel's avatar
Ben Boeckel committed
99
100
      mxml
      scipy)
101
102
103

    if (NOT APPLE)
      list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
104
        boxlib
105
106
        catalyst
        egl
Chuck Atkins's avatar
Chuck Atkins committed
107
        expat
108
        fontconfig
Chuck Atkins's avatar
Chuck Atkins committed
109
        glproto
110
        gperf
111
112
113
        llvm
        mesa
        osmesa
Ben Boeckel's avatar
Ben Boeckel committed
114
        paraviewsdk
115
        socat)
116
117
118
119
    endif ()
  endif ()

  list(APPEND projects
120
    ospraymaterials
121
    paraviewgettingstartedguide
122
    paraviewtutorialdata)
123

124
  if (USE_NONFREE_COMPONENTS)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
125
    # add non-free projects here.
Ben Boeckel's avatar
Ben Boeckel committed
126
127
128
129
    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
130
131
        nvidiamdl
        nvidiaoptix)
Ben Boeckel's avatar
Ben Boeckel committed
132
133
134
135

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

139
140
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
141
      ftjam
Ken Martin's avatar
Ken Martin committed
142
      openvr
143
144
145
      pywin32)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
146
147
148
149
150
  if (WIN32 OR (UNIX AND NOT APPLE))
    list(APPEND projects
      nvidiaindex)
  endif ()

151
152
153
154
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
155

156
157
158
159
160
161
162
163
164
function (superbuild_sanity_check)
  if (NOT paraview_enabled AND NOT catalyst_enabled)
    message(WARNING "ParaView is disabled...")
  endif ()

  include(qt.functions)

  superbuild_qt_sanity_check()

165
166
167
168
169
170
171
  # 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 ()

172
  # Sanity check: Cannot have EGL and Qt enabled at the same time.
Ben Boeckel's avatar
Ben Boeckel committed
173
  if (egl_enabled AND qt5_enabled)
174
    message(SEND_ERROR "Cannot enable EGL and Qt at the same time.")
175
  endif ()
176
177
178
179

  # 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.")
180
181
  endif ()

182
183
184
185
186
  # 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 ()

187
  # Sanity check: Cannot have OSMesa and Qt enabled at the same time if we're building ParaView.
Ben Boeckel's avatar
Ben Boeckel committed
188
  if (osmesa_enabled AND qt5_enabled AND paraview_enabled)
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    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 ()

  # Sanity check: Cannot have ParaView and Catalyst enabled at the same time.
  if (paraview_enabled AND catalyst_enabled)
    message(SEND_ERROR "Cannot enable ParaView and Catalyst at the same time.")
  endif ()
endfunction ()

203
204
205
function (superbuild_add_packaging)
  if (WIN32)
    set(generators
206
207
      ZIP
      NSIS)
208
209
210
211
212
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
Cory Quammen's avatar
Cory Quammen committed
213
214
      TGZ
      TXZ)
215
  endif ()
216
  list(GET generators 0 default_generator)
217

Ben Boeckel's avatar
Ben Boeckel committed
218
219
220
  if (USE_SYSTEM_qt5)
    list(APPEND superbuild_export_variables
      Qt5_DIR)
221
222
223
224
    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
225
  endif ()
226
227
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
228

229
230
231
232
  if (NOT DEFINED PARAVIEW_CATALYST_EDITION)
    set(PARAVIEW_CATALYST_EDITION Full)
  endif ()

233
234
  include(paraview.suffix)
  list(APPEND superbuild_export_variables
235
    mesa_USE_SWR
236
    mesa_SWR_ARCH
237
    nvidiaindex_SOURCE_SELECTION
238
    PARAVIEW_DEFAULT_SYSTEM_GL
239
240
    PARAVIEW_PACKAGE_SUFFIX
    PARAVIEW_CATALYST_EDITION)
Chuck Atkins's avatar
Chuck Atkins committed
241
242
243
244
245
246
247
248
249
250
251
252
253
254

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

256
257
258
259
260
261
262
263
  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 ()

264
265
  set(default_package)

266
267
  foreach (generator IN LISTS generators)
    if (paraview_enabled)
268
269
270
      if (NOT default_package)
        set(default_package paraview)
      endif ()
271
272
      superbuild_add_extra_package_test(paraview "${generator}"
        LABELS  "ParaView"
273
        TIMEOUT 6400)
274
    endif ()
275
    if (catalyst_enabled OR (paraview_enabled AND UNIX AND NOT APPLE))
276
277
278
      if (NOT default_package)
        set(default_package catalyst)
      endif ()
279
280
      superbuild_add_extra_package_test(catalyst "${generator}"
        LABELS  "ParaView"
281
        TIMEOUT 6400)
282
283
    endif ()
  endforeach ()
Chuck Atkins's avatar
Chuck Atkins committed
284
285

  if (paraviewsdk_enabled)
286
    set(default_package paraviewsdk)
Chuck Atkins's avatar
Chuck Atkins committed
287
288
289
    superbuild_add_extra_package_test(paraviewsdk "TGZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Cory Quammen's avatar
Cory Quammen committed
290
291
292
    superbuild_add_extra_package_test(paraviewsdk "TXZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
Chuck Atkins's avatar
Chuck Atkins committed
293
  endif ()
294
295
296
297

  if (default_package)
    superbuild_enable_install_target("${default_package}/${default_generator}")
  endif ()
298
endfunction ()
299

300
301
302
303
function (superbuild_add_tests)
  add_subdirectory("${CMAKE_SOURCE_DIR}/tests" "${CMAKE_BINARY_DIR}/tests")
endfunction ()

304
305
306
307
308
309
310
311
312
313
314
315
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

316
317
set(boost_libraries
  date_time
Ben Boeckel's avatar
Ben Boeckel committed
318
319
320
  filesystem
  iostreams
  program_options
321
322
  system
  thread)
Dan Lipsa's avatar
Dan Lipsa committed
323
324
set(boost_extra_options
  "-sNO_BZIP2=1")
325
326
327

list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
328
list(APPEND superbuild_ctest_custom_files
329
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake")
330
331
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
332

333
334
335
# set the default arguments used for "git clone"
set(_git_clone_arguments_default --progress)

336
337
338
# set the default for cxx11 to be enabled for this project
set(_superbuild_default_cxx11 ON)

Ben Boeckel's avatar
Ben Boeckel committed
339
340
341
# set the default for qt5 to be 5.8
set(_superbuild_qt5_default_selection "5.8")

Ben Boeckel's avatar
Ben Boeckel committed
342
343
344
345
# Build UCS4 binaries by default. This is more compatible with Linux
# distributions.
set(_python_unicode_default "UCS4")

346
347
348
349
350
351
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 ()

352
add_subdirectory(superbuild)