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

3
4
project(cmb-superbuild)

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

8
9
macro (superbuild_setup_variables)
  include(SuperbuildVersionMacros)
10

11
  if (cmb_SOURCE_SELECTION STREQUAL "git")
12
13
    # 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.
14
    set(CMB_VERSION_DEFAULT  "<FETCH_FROM_GIT>"
15
      CACHE STRING "The default version of CMB to use if it cannot be detected")
16
17
18
19
    if (CMB_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
      include(cmbVersion)
      set(CMB_VERSION_DEFAULT "${cmb_version_major}.${cmb_version_minor}.${cmb_version_patch}")
    endif ()
20
21
22
    mark_as_advanced(CMB_VERSION_DEFAULT)
    set(cmb_default_version "${CMB_VERSION_DEFAULT}")
  elseif (cmb_SOURCE_SELECTION STREQUAL "source")
T.J. Corona's avatar
T.J. Corona committed
23
    # If it is a git repo, we'll get it that way. Otherwise, we will look at the
24
25
26
27
28
29
30
    # `version.txt` in the checkout.
    set(cmb_default_version "")
  else ()
    # The selection is the version number; use it.
    set(cmb_default_version "${cmb_SOURCE_SELECTION}")
  endif()
  superbuild_set_version_variables(cmb "${cmb_default_version}" "cmb-version.cmake" "version.txt")
31
  set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
32

T.J. Corona's avatar
T.J. Corona committed
33
  if (smtk_SOURCE_SELECTION STREQUAL "git")
34
35
    # 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.
36
    set(SMTK_VERSION_DEFAULT  "<FETCH_FROM_GIT>"
37
      CACHE STRING "The default version of SMTK to use if it cannot be detected")
38
39
40
41
    if (SMTK_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
      include(smtkVersion)
      set(SMTK_VERSION_DEFAULT "${smtk_version_major}.${smtk_version_minor}.${smtk_version_patch}")
    endif ()
42
43
44
45
46
47
48
49
50
51
52
53
54
    mark_as_advanced(SMTK_VERSION_DEFAULT)
    set(smtk_default_version "${SMTK_VERSION_DEFAULT}")
  elseif (smtk_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(smtk_default_version "")
  else ()
    # The selection is the version number; use it.
    set(smtk_default_version "${smtk_SOURCE_SELECTION}")
  endif()
  superbuild_set_version_variables(smtk "${smtk_default_version}" "smtk-version.cmake" "version.txt")
  set(smtk_version "${smtk_version_major}.${smtk_version_minor}")

55
  if (paraview_SOURCE_SELECTION STREQUAL "git")
Ben Boeckel's avatar
Ben Boeckel committed
56
57
58
    include(paraviewVersion)
    set(paraview_default_version "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
  elseif (paraview_SOURCE_SELECTION STREQUAL "master")
59
60
61
62
63
64
65
66
67
68
    # 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.
    set(PARAVIEW_VERSION_DEFAULT "<FETCH_FROM_GIT>"
      CACHE STRING "The default version of ParaView to use if it cannot be detected")
    if (PARAVIEW_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
      include(paraviewVersion)
      set(PARAVIEW_VERSION_DEFAULT "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
    endif ()
    mark_as_advanced(PARAVIEW_VERSION_DEFAULT)
    set(paraview_default_version "${PARAVIEW_VERSION_DEFAULT}")
69
  elseif (paraview_SOURCE_SELECTION STREQUAL "for-v6.3.0")
Ben Boeckel's avatar
Ben Boeckel committed
70
71
    include(paraviewVersion)
    set(paraview_default_version "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
72
73
74
75
76
77
  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 "")
  endif ()
  superbuild_set_version_variables(paraview "${paraview_default_version}" "paraview-version.cmake" "version.txt")
78
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
79

T.J. Corona's avatar
T.J. Corona committed
80
  superbuild_set_version_variables(vtk "9.0.0" "vtk-version.cmake")
T.J. Corona's avatar
T.J. Corona committed
81
  set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
T.J. Corona's avatar
T.J. Corona committed
82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  if (aeva_SOURCE_SELECTION STREQUAL "git")
    # 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.
    set(AEVA_VERSION_DEFAULT  "<FETCH_FROM_GIT>"
      CACHE STRING "The default version of AEVA to use if it cannot be detected")
    if (AEVA_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
      include(aevaVersion)
      set(AEVA_VERSION_DEFAULT "${aeva_version_major}.${aeva_version_minor}.${aeva_version_patch}")
    endif ()
    mark_as_advanced(AEVA_VERSION_DEFAULT)
    set(aeva_default_version "${AEVA_VERSION_DEFAULT}")
  elseif (aeva_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(aeva_default_version "")
  else ()
    # The selection is the version number; use it.
    set(aeva_default_version "${aeva_SOURCE_SELECTION}")
  endif()
  superbuild_set_version_variables(aeva "${aeva_default_version}" "aeva-version.cmake" "version.txt")
  set(aeva_version "${aeva_version_major}.${aeva_version_minor}")
104
105
106
endmacro ()

function (superbuild_find_projects var)
107
108
  include(CMBSuperbuildMacros)

109
110
111
112
  set(projects
    boost
    bzip2
    cmb
113
    cmbusersguide
114
    cmbworkflows
115
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
116
    cxx11
117
    eigen
118
    fortran
119
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
120
    ftgl
121
122
    gdal
    hdf5
123
124
    itk
    itkvtkglue
125
    lapack
Ben Boeckel's avatar
Ben Boeckel committed
126
    las
127
    libarchive
T.J. Corona's avatar
T.J. Corona committed
128
    matplotlib
129
130
    moab
    netcdf
131
    netgen
132
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
133
    numpy
David Thompson's avatar
David Thompson committed
134
    occt
135
    opencascadesession
Jacob Becker's avatar
Jacob Becker committed
136
    opencv
137
    paraview
138
139
140
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
David Thompson's avatar
David Thompson committed
141
    pegtl
142
    png
T.J. Corona's avatar
T.J. Corona committed
143
    protobuf
T.J. Corona's avatar
T.J. Corona committed
144
    pyarc
145
    pybind11
146
    python
147
    python2
148
    python3
T.J. Corona's avatar
T.J. Corona committed
149
    pythoncycler
150
    pythoncython
T.J. Corona's avatar
T.J. Corona committed
151
    pythondateutil
152
    pythondiskcache
153
    pythongirderclient
T.J. Corona's avatar
T.J. Corona committed
154
155
    pythonkiwisolver
    pythonpyparsing
156
    pythonrequests
157
    pythonrequeststoolbelt
158
    pythonsetuptools
T.J. Corona's avatar
T.J. Corona committed
159
160
    pythonsix
    pytz
161
    qt5
162
    remus
T.J. Corona's avatar
T.J. Corona committed
163
    rggsession
164
    smtk
165
    smtkusersguide
166
    szip
T.J. Corona's avatar
T.J. Corona committed
167
    vtk
168
    vtkonly
169
170
171
172
    vxl
    zeromq
    zlib)

173
174
  if (NOT WIN32)
    list(APPEND projects
175
      ffi
176
      fontconfig
177
      gperf
178
      libxml2
179
      meshkit
180
      pkgconf
181
      sqlite
182
      utillinux)
183
184
  endif ()

185
186
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
187
      ftjam
188
      pywin32)
189
190
  endif ()

191
192
  if (NOT DEVELOPER_MODE_smtk)
    list(APPEND projects
John Tourtellott's avatar
John Tourtellott committed
193
      smtkprojectmanager
194
      smtkresourcemanagerstate)
195
  endif ()
T.J. Corona's avatar
T.J. Corona committed
196

197
198
199
  list(APPEND projects
    aeva
    aevasession
200
    aevaexampledata
201
  )
T.J. Corona's avatar
T.J. Corona committed
202

203
  # For now it's a convenient option to control smtk documentation.
204
  option(ENABLE_DOCUMENTATION "Enable smtk documentation" ON)
205

206
207
208
209
  option(USE_NONFREE_COMPONENTS "Enable the non-free parts of the superbuild" OFF)
  mark_as_advanced(USE_NONFREE_COMPONENTS)
  if (USE_NONFREE_COMPONENTS)
    list(APPEND projects
210
211
      capstone
      cubit
212
213
      triangle)
  endif ()
214

215
216
217
218
219
220
221
222
223
224
  # Capstone and Cubit are closed-source programs to which Kitware developers
  # have access. We provide logic for situating these programs into our
  # superbuild for development purposes only. These packages are not bundled or
  # distributed.
  set(KW_SHARE "" CACHE PATH "Location of Kitware-internal share directory.")

  if (NOT (capstone_enabled OR cubit_enabled))
    mark_as_advanced(KW_SHARE)
  endif ()

225
226
227
228
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
229

230
function (superbuild_sanity_check)
231
  if (vtkonly_enabled AND paraview_enabled)
T.J. Corona's avatar
T.J. Corona committed
232
    message(FATAL_ERROR
233
      "Only one of the following projects should be enabled: vtkonly, paraview.")
T.J. Corona's avatar
T.J. Corona committed
234
  endif ()
T.J. Corona's avatar
T.J. Corona committed
235
  if (NOT smtk_enabled AND NOT cmb_enabled AND NOT aeva_enabled)
236
    message(FATAL_ERROR
T.J. Corona's avatar
T.J. Corona committed
237
      "At least one of the following projects must be enabled: cmb, smtk, aeva.")
238
239
240
  endif ()
endfunction ()

241
function (superbuild_add_packaging)
T.J. Corona's avatar
T.J. Corona committed
242
  if (NOT (cmb_enabled OR aeva_enabled) OR DEVELOPER_MODE_cmb)
243
244
245
    return ()
  endif ()

246
247
248
249
250
251
252
253
254
255
256
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

257
258
259
  # Force qt SVG support, so CMB/ParaView can use SVG icons
  set(qt5_ENABLE_SVG ON CACHE INTERNAL "CMB/ParaView requires SVG support")

Ben Boeckel's avatar
Ben Boeckel committed
260
  if (UNIX AND NOT APPLE AND NOT USE_SYSTEM_qt5)
Ben Boeckel's avatar
Ben Boeckel committed
261
    set(Qt5_DIR "${superbuild_install_location}/lib/cmake/Qt5")
Ben Boeckel's avatar
Ben Boeckel committed
262
263
    set(qt5_version "${qt5_SOURCE_SELECTION}")
  else ()
Ben Boeckel's avatar
Ben Boeckel committed
264
265
    list(APPEND superbuild_export_variables
      Qt5_DIR)
266
267
    find_package(Qt5 QUIET REQUIRED COMPONENTS Core)
    set(qt5_version "${Qt5Core_VERSION_MAJOR}.${Qt5Core_VERSION_MINOR}")
Ben Boeckel's avatar
Ben Boeckel committed
268
  endif ()
269
270
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
271

272
273
274
  list(APPEND superbuild_export_variables
    BOOST_ADDITIONAL_LIBRARIES)

275
  if (cmb_enabled)
276
277
278
279
    include(cmb.suffix)
    list(APPEND superbuild_export_variables
      CMB_PACKAGE_SUFFIX)

280
281
282
283
    set(CMB_PACKAGE_FILE_NAME ""
      CACHE STRING "If set, overrides the generated filename for the package")
    list(APPEND superbuild_export_variables
      CMB_PACKAGE_FILE_NAME)
T.J. Corona's avatar
T.J. Corona committed
284
285
286

    foreach (generator IN LISTS generators)
      superbuild_add_extra_package_test(modelbuilder "${generator}"
Ben Boeckel's avatar
Ben Boeckel committed
287
288
        LABELS  "CMB"
        TIMEOUT 6400)
T.J. Corona's avatar
T.J. Corona committed
289
290
291
292
    endforeach ()
  endif ()

  if (aeva_enabled)
293
294
295
296
    include(aeva.suffix)
    list(APPEND superbuild_export_variables
      AEVA_PACKAGE_SUFFIX)

T.J. Corona's avatar
T.J. Corona committed
297
298
299
300
301
302
303
    set(AEVA_PACKAGE_FILE_NAME ""
      CACHE STRING "If set, overrides the generated filename for the package")
    list(APPEND superbuild_export_variables
      AEVA_PACKAGE_FILE_NAME)

    foreach (generator IN LISTS generators)
      superbuild_add_extra_package_test(aeva "${generator}"
Ben Boeckel's avatar
Ben Boeckel committed
304
305
        LABELS  "AEVA"
        TIMEOUT 6400)
T.J. Corona's avatar
T.J. Corona committed
306
    endforeach ()
307
  endif ()
308
endfunction ()
309

310
311
macro (superbuild_setup_tests)
  if (cmb_enabled)
312
    set(DROP_LOCATION "/submit.php?project=CMB")
313
  elseif (smtk_enabled)
314
    set(DROP_LOCATION "/submit.php?project=SMTK")
315
316
317
  endif ()
endmacro ()

318
319
320
321
322
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
323

324
325
326
327
328
329
330
331
332
333
# Make binaries on linux more compatible by default
option(SB_LINUX_CORE2_COMPATIBLE "On linux, enable core2 architecture compatible builds, disabling avx512f" ON)
mark_as_advanced(SB_LINUX_CORE2_COMPATIBLE)
if (SB_LINUX_CORE2_COMPATIBLE AND UNIX AND NOT APPLE AND
  (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
   CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
  string(APPEND CMAKE_C_FLAGS " -march=core2 -mno-avx512f")
  string(APPEND CMAKE_CXX_FLAGS " -march=core2 -mno-avx512f")
endif()

T.J. Corona's avatar
T.J. Corona committed
334
# Default Qt5 to ON
Ben Boeckel's avatar
Ben Boeckel committed
335
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
336

337
338
339
340
341
342
343
344
345
346
347
348
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

349
set(BOOST_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional boost libraries to build and package")
350
351
mark_as_advanced(BOOST_ADDITIONAL_LIBRARIES)

352
set(boost_minimum_version 1.64.0)
353
354
355
356
357
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
358
  iostreams
David Thompson's avatar
David Thompson committed
359
  log
360
  program_options
361
  regex
362
  serialization
363
  system
David Thompson's avatar
David Thompson committed
364
  thread
365
366
  timer
  ${BOOST_ADDITIONAL_LIBRARIES})
367

368
369
370
371
372
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

373
374
375
376
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

377
378
379
380
381
382
383
384
set(suppress_projects
  boost
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
David Thompson's avatar
David Thompson committed
385
  occt
386
  png
387
  pybind11
388
389
390
391
392
393
394
395
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

396
397
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
398
list(APPEND superbuild_ctest_custom_files
399
400
401
402
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)
403
404
405
406

if (BUILD_TESTING)
  include(CTest)
endif ()