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 "<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
  superbuild_set_version_variables(paraview "5.6.0" "paraview-version.cmake" "version.txt")
56
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
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
85
    opencv
86
    paraview
87 88 89
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
90
    pegtl
91
    png
T.J. Corona's avatar
T.J. Corona committed
92
    protobuf
T.J. Corona's avatar
T.J. Corona committed
93
    pyarc
94
    pybind11
95
    python
96
    pythondiskcache
97 98
    pythongirderclient
    pythonrequests
99
    pythonrequeststoolbelt
100
    pythonsetuptools
101
    qt
102
    qt4
103
    qt5
104
    remus
T.J. Corona's avatar
T.J. Corona committed
105
    rggsession
106
    smtk
107
    smtkusersguide
108
    szip
109
    vtk
110
    vtkonly
111 112 113 114
    vxl
    zeromq
    zlib)

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

123 124
  if (WIN32)
    list(APPEND projects
125
      ftjam
126 127
      pythonsetuptools
      pywin32)
128 129
  endif ()

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

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

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

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

162
function (superbuild_sanity_check)
163
  if (vtkonly_enabled AND paraview_enabled)
164
    message(FATAL_ERROR
165
      "Only one of the following projects should be enabled: vtkonly, paraview.")
166
  endif ()
167 168 169 170 171 172
  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 ()

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

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

Ben Boeckel's avatar
Ben Boeckel committed
189 190 191 192 193 194
  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)
195 196 197 198
    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
199
  endif ()
200 201
  list(APPEND superbuild_export_variables
    qt5_version)
Ben Boeckel's avatar
Ben Boeckel committed
202

203 204 205
  list(APPEND superbuild_export_variables
    BOOST_ADDITIONAL_LIBRARIES)

206 207 208 209 210 211 212 213 214 215 216
  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 ()

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

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

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

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

240
# Default Qt5 to ON
Ben Boeckel's avatar
Ben Boeckel committed
241
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
242

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

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

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

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

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

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

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