CMakeLists.txt 8.87 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 56 57 58 59 60 61 62 63 64 65
  if (paraview_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(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}")
66 67
  elseif (paraview_SOURCE_SELECTION STREQUAL "for-v6.3.0")
    set(paraview_default_version "5.7.0")
68 69 70 71 72 73
  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")
74
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
75

76 77
  superbuild_set_version_variables(vtk "8.1.0" "vtk-version.cmake")
  set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
78 79 80
endmacro ()

function (superbuild_find_projects var)
81 82
  include(CMBSuperbuildMacros)

83 84 85 86
  set(projects
    boost
    bzip2
    cmb
87
    cmbusersguide
88
    cmbworkflows
89
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
90
    cxx11
91
    eigen
92
    fortran
93
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
94
    ftgl
95 96
    gdal
    hdf5
97
    lapack
Ben Boeckel's avatar
Ben Boeckel committed
98
    las
99
    libarchive
T.J. Corona's avatar
T.J. Corona committed
100
    matplotlib
101 102
    moab
    netcdf
103
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
104
    numpy
105
    occt
106
    opencv
107
    paraview
108 109 110
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
David Thompson's avatar
David Thompson committed
111
    pegtl
112
    png
T.J. Corona's avatar
T.J. Corona committed
113
    protobuf
T.J. Corona's avatar
T.J. Corona committed
114
    pyarc
115
    pybind11
116
    python
117
    pythondiskcache
118 119
    pythongirderclient
    pythonrequests
120
    pythonrequeststoolbelt
121
    pythonsetuptools
122
    qt
123
    qt4
124
    qt5
125
    remus
T.J. Corona's avatar
T.J. Corona committed
126
    rggsession
127
    smtk
128
    #smtkusersguide
129
    szip
130
    vtk
131
    vtkonly
132 133 134 135
    vxl
    zeromq
    zlib)

136 137 138
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
139
      gperf
140 141
      libxml2
      meshkit)
142 143
  endif ()

144 145
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
146
      ftjam
147 148
      pythonsetuptools
      pywin32)
149 150
  endif ()

151 152
  if (NOT DEVELOPER_MODE_smtk)
    list(APPEND projects
153
      smtkprojectmanager
154
      smtkresourcemanagerstate)
155
  endif ()
156
  # For now it's a convenient option to control smtk documentation.
157
  option(ENABLE_DOCUMENTATION "Enable smtk documentation" ON)
158

159 160 161 162
  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
163 164
      capstone
      cubit
165 166
      triangle)
  endif ()
167

168 169 170 171 172 173 174 175 176 177
  # 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 ()

178 179 180 181
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
182

183
function (superbuild_sanity_check)
184
  if (vtkonly_enabled AND paraview_enabled)
185
    message(FATAL_ERROR
186
      "Only one of the following projects should be enabled: vtkonly, paraview.")
187
  endif ()
188 189 190 191 192 193
  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 ()

194
function (superbuild_add_packaging)
195 196 197 198
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

199 200 201 202 203 204 205 206 207 208 209
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
210 211 212 213 214 215
  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)
216 217 218 219
    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
220
  endif ()
221 222
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
223

224 225 226
  list(APPEND superbuild_export_variables
    BOOST_ADDITIONAL_LIBRARIES)

227 228 229 230 231 232 233 234 235 236 237
  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 ()

238
  foreach (generator IN LISTS generators)
Ben Boeckel's avatar
Ben Boeckel committed
239 240
    superbuild_add_extra_package_test(modelbuilder "${generator}"
      LABELS  "CMB"
241
      TIMEOUT 6400)
242
  endforeach ()
243
endfunction ()
244

245 246
macro (superbuild_setup_tests)
  if (cmb_enabled)
247
    set(DROP_LOCATION "/submit.php?project=CMB")
248
  elseif (smtk_enabled)
249
    set(DROP_LOCATION "/submit.php?project=SMTK")
250 251 252
  endif ()
endmacro ()

253 254 255 256 257
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
258

259 260
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

261
# Default Qt5 to ON
Ben Boeckel's avatar
Ben Boeckel committed
262
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
263

264 265 266 267 268 269 270 271 272 273 274 275
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

276
set(BOOST_ADDITIONAL_LIBRARIES "" CACHE STRING "Additional boost libraries to build and package")
277 278
mark_as_advanced(BOOST_ADDITIONAL_LIBRARIES)

279
set(boost_minimum_version 1.64.0)
280 281 282 283 284
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
285
  iostreams
David Thompson's avatar
David Thompson committed
286
  log
287
  program_options
288
  regex
289
  serialization
290
  system
David Thompson's avatar
David Thompson committed
291
  thread
292 293
  timer
  ${BOOST_ADDITIONAL_LIBRARIES})
294

295 296 297 298 299
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

300 301 302 303
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

304 305 306 307 308 309 310 311
set(suppress_projects
  boost
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
312
  occt
313
  png
314
  pybind11
315 316 317 318 319 320 321 322
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

323 324
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
325
list(APPEND superbuild_ctest_custom_files
326 327 328 329
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)