CMakeLists.txt 8.12 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.5.0-RC4"
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
    paraviewweb
57
    paraviewwebdivvy
Ben Boeckel's avatar
Ben Boeckel committed
58
59
    paraviewweblightviz
    paraviewwebvisualizer
60
    png
61
62
    pythonautobahn
    pythonconstantly
63
64
    pythoncycler
    pythondateutil
65
66
    pythonhyperlink
    pythonincremental
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
67
    pythonpygments
68
    pythonpyparsing
Ben Boeckel's avatar
Ben Boeckel committed
69
    pythonsetuptools
70
71
72
73
    pythonsix
    pythontwisted
    pythontxaio
    pythonwslink
Ben Boeckel's avatar
Ben Boeckel committed
74
    pythonzope
75
    pythonzopeinterface
76
    pytz
77
78
79
80
81
82
83
    qt5
    silo
    szip
    tbb
    visitbridge
    vortexfinder2
    vrpn
Robert Maynard's avatar
Robert Maynard committed
84
    vtkm
85
86
87
    xdmf3
    zlib)

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

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

  list(APPEND projects
117
    ospraymaterials
118
    paraviewgettingstartedguide
119
    paraviewtutorialdata)
120

121
  if (USE_NONFREE_COMPONENTS)
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
122
    # add non-free projects here.
123
  endif ()
124

125
126
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
127
      ftjam
Ken Martin's avatar
Ken Martin committed
128
      openvr
129
130
131
      pywin32)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
132
133
134
135
136
  if (WIN32 OR (UNIX AND NOT APPLE))
    list(APPEND projects
      nvidiaindex)
  endif ()

137
138
139
140
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
141

142
143
144
145
146
147
148
149
150
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()

151
152
153
154
155
156
157
  # 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 ()

158
  # Sanity check: Cannot have EGL and Qt enabled at the same time.
Ben Boeckel's avatar
Ben Boeckel committed
159
  if (egl_enabled AND qt5_enabled)
160
    message(SEND_ERROR "Cannot enable EGL and Qt at the same time.")
161
  endif ()
162
163
164
165

  # 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.")
166
167
  endif ()

168
169
170
171
172
  # 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 ()

173
  # Sanity check: Cannot have OSMesa and Qt enabled at the same time if we're building ParaView.
Ben Boeckel's avatar
Ben Boeckel committed
174
  if (osmesa_enabled AND qt5_enabled AND paraview_enabled)
175
176
177
178
179
180
181
182
183
184
185
186
187
188
    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 ()

189
190
191
function (superbuild_add_packaging)
  if (WIN32)
    set(generators
192
193
      ZIP
      NSIS)
194
195
196
197
198
199
200
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()
201
  list(GET generators 0 default_generator)
202

Ben Boeckel's avatar
Ben Boeckel committed
203
204
205
206
207
  if (USE_SYSTEM_qt5)
    list(APPEND superbuild_export_variables
      Qt5_DIR)
  endif ()

208
209
210
211
  if (NOT DEFINED PARAVIEW_CATALYST_EDITION)
    set(PARAVIEW_CATALYST_EDITION Full)
  endif ()

212
213
  include(paraview.suffix)
  list(APPEND superbuild_export_variables
214
    mesa_USE_SWR
215
    mesa_SWR_ARCH
216
    PARAVIEW_DEFAULT_SYSTEM_GL
217
218
    PARAVIEW_PACKAGE_SUFFIX
    PARAVIEW_CATALYST_EDITION)
Chuck Atkins's avatar
Chuck Atkins committed
219
220
221
222
223
224
225
226
227
228
229
230
231
232

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

234
235
236
237
238
239
240
241
  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 ()

242
243
  set(default_package)

244
245
  foreach (generator IN LISTS generators)
    if (paraview_enabled)
246
247
248
      if (NOT default_package)
        set(default_package paraview)
      endif ()
249
250
      superbuild_add_extra_package_test(paraview "${generator}"
        LABELS  "ParaView"
251
        TIMEOUT 6400)
252
    endif ()
253
    if (catalyst_enabled OR (paraview_enabled AND UNIX AND NOT APPLE))
254
255
256
      if (NOT default_package)
        set(default_package catalyst)
      endif ()
257
258
      superbuild_add_extra_package_test(catalyst "${generator}"
        LABELS  "ParaView"
259
        TIMEOUT 6400)
260
261
    endif ()
  endforeach ()
Chuck Atkins's avatar
Chuck Atkins committed
262
263

  if (paraviewsdk_enabled)
264
    set(default_package paraviewsdk)
Chuck Atkins's avatar
Chuck Atkins committed
265
266
267
268
    superbuild_add_extra_package_test(paraviewsdk "TGZ"
      LABELS  "ParaView"
      TIMEOUT 6400)
  endif ()
269
270
271
272

  if (default_package)
    superbuild_enable_install_target("${default_package}/${default_generator}")
  endif ()
273
endfunction ()
274

275
276
277
278
function (superbuild_add_tests)
  add_subdirectory("${CMAKE_SOURCE_DIR}/tests" "${CMAKE_BINARY_DIR}/tests")
endfunction ()

279
280
281
282
283
284
285
286
287
288
289
290
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

291
292
set(boost_libraries
  date_time
Ben Boeckel's avatar
Ben Boeckel committed
293
294
295
  filesystem
  iostreams
  program_options
296
297
  system
  thread)
Dan Lipsa's avatar
Dan Lipsa committed
298
299
set(boost_extra_options
  "-sNO_BZIP2=1")
300
301
302

list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
303
list(APPEND superbuild_ctest_custom_files
304
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake")
305
306
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
307

308
309
310
# set the default arguments used for "git clone"
set(_git_clone_arguments_default --progress)

311
312
313
# set the default for cxx11 to be enabled for this project
set(_superbuild_default_cxx11 ON)

Ben Boeckel's avatar
Ben Boeckel committed
314
315
316
# set the default for qt5 to be 5.8
set(_superbuild_qt5_default_selection "5.8")

317
318
319
320
321
322
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 ()

323
add_subdirectory(superbuild)