CMakeLists.txt 7.82 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 "6.3.0"
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 "3.3.0"
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}")

David Thompson's avatar
David Thompson committed
55
  superbuild_set_version_variables(paraview "5.6.0" "paraview-version.cmake" "version.txt")
56
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
T.J. Corona's avatar
T.J. Corona committed
57
58
  superbuild_set_version_variables(vtk "8.1.0" "vtk-version.cmake")
  set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
59
60
61
endmacro ()

function (superbuild_find_projects var)
62
63
  include(CMBSuperbuildMacros)

64
65
66
67
  set(projects
    boost
    bzip2
    cmb
68
    cmbusersguide
69
    cmbworkflows
70
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
71
    cxx11
72
    eigen
73
    fortran
74
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
75
    ftgl
76
77
    gdal
    hdf5
78
    lapack
79
    libarchive
T.J. Corona's avatar
T.J. Corona committed
80
    matplotlib
81
82
    moab
    netcdf
83
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
84
    numpy
David Thompson's avatar
David Thompson committed
85
    occt
Jacob Becker's avatar
Jacob Becker committed
86
    opencv
87
    paraview
88
89
90
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
David Thompson's avatar
David Thompson committed
91
    pegtl
92
    png
T.J. Corona's avatar
T.J. Corona committed
93
    protobuf
T.J. Corona's avatar
T.J. Corona committed
94
    pyarc
95
    pybind11
96
    python
97
    pythondiskcache
98
99
    pythongirderclient
    pythonrequests
100
    pythonrequeststoolbelt
101
    pythonsetuptools
102
    qt
103
    qt4
104
    qt5
105
    remus
T.J. Corona's avatar
T.J. Corona committed
106
    rggsession
107
    smtk
108
    #smtkusersguide
109
    szip
T.J. Corona's avatar
T.J. Corona committed
110
    vtk
111
    vtkonly
112
113
114
115
    vxl
    zeromq
    zlib)

116
117
118
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
119
      gperf
120
121
      libxml2
      meshkit)
122
123
  endif ()

124
125
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
126
      ftjam
127
128
      pythonsetuptools
      pywin32)
129
130
  endif ()

131
132
  if (NOT DEVELOPER_MODE_smtk)
    list(APPEND projects
John Tourtellott's avatar
John Tourtellott committed
133
      smtkprojectmanager
134
      smtkresourcemanagerstate)
135
  endif ()
136
  # For now it's a convenient option to control smtk documentation.
137
  option(ENABLE_DOCUMENTATION "Enable smtk documentation" ON)
138

139
140
141
142
  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
143
144
      capstone
      cubit
145
146
      triangle)
  endif ()
147

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

158
159
160
161
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
162

163
function (superbuild_sanity_check)
164
  if (vtkonly_enabled AND paraview_enabled)
T.J. Corona's avatar
T.J. Corona committed
165
    message(FATAL_ERROR
166
      "Only one of the following projects should be enabled: vtkonly, paraview.")
T.J. Corona's avatar
T.J. Corona committed
167
  endif ()
168
169
170
171
172
173
  if (NOT smtk_enabled AND NOT cmb_enabled)
    message(FATAL_ERROR
      "At least one of the following projects must be enabled: cmb, smtk.")
  endif ()
endfunction ()

174
function (superbuild_add_packaging)
175
176
177
178
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

179
180
181
182
183
184
185
186
187
188
189
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
190
191
192
193
194
195
  if (qt5_built_by_superbuild)
    set(Qt5_DIR "${superbuild_install_location}/lib/cmake/Qt5")
  endif ()
  if (USE_SYSTEM_qt5)
    list(APPEND superbuild_export_variables
      Qt5_DIR)
196
197
198
199
    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
200
  endif ()
201
202
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
203

204
205
206
  list(APPEND superbuild_export_variables
    BOOST_ADDITIONAL_LIBRARIES)

207
208
209
210
211
212
213
214
215
216
217
  include(cmb.suffix)
  list(APPEND superbuild_export_variables
    CMB_PACKAGE_SUFFIX)

  if (cmb_enabled)
    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)
  endif ()

218
  foreach (generator IN LISTS generators)
Ben Boeckel's avatar
Ben Boeckel committed
219
220
    superbuild_add_extra_package_test(modelbuilder "${generator}"
      LABELS  "CMB"
221
      TIMEOUT 6400)
222
  endforeach ()
223
endfunction ()
224

225
226
macro (superbuild_setup_tests)
  if (cmb_enabled)
227
    set(DROP_LOCATION "/submit.php?project=CMB")
228
  elseif (smtk_enabled)
229
    set(DROP_LOCATION "/submit.php?project=SMTK")
230
231
232
  endif ()
endmacro ()

233
234
235
236
237
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
238

239
240
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

T.J. Corona's avatar
T.J. Corona committed
241
# Default Qt5 to ON
Ben Boeckel's avatar
Ben Boeckel committed
242
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
243

244
245
246
247
248
249
250
251
252
253
254
255
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

256
set(BOOST_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional boost libraries to build and package")
257
258
mark_as_advanced(BOOST_ADDITIONAL_LIBRARIES)

259
set(boost_minimum_version 1.64.0)
260
261
262
263
264
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
David Thompson's avatar
David Thompson committed
265
  log
266
  regex
267
  serialization
268
  system
David Thompson's avatar
David Thompson committed
269
  thread
270
271
  timer
  ${BOOST_ADDITIONAL_LIBRARIES})
272

273
274
275
276
277
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

278
279
280
281
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

282
283
284
285
286
287
288
289
set(suppress_projects
  boost
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
David Thompson's avatar
David Thompson committed
290
  occt
291
  png
292
  pybind11
293
294
295
296
297
298
299
300
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

301
302
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
303
list(APPEND superbuild_ctest_custom_files
304
305
306
307
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)