CMakeLists.txt 7 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.0.0"
15 16 17 18
      CACHE STRING "The default version of CMB to use if it cannot be detected")
    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
19
    # If it is a git repo, we'll get it that way. Otherwise, we will look at the
20 21 22 23 24 25 26
    # `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")
27
  set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
28 29 30 31

  if (smtk_SOURCE_SELECTION STREQUAL "git" OR smtk_SOURCE_SELECTION STREQUAL "from_cmb")
    # 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.
32
    set(SMTK_VERSION_DEFAULT "3.0.0"
33 34 35 36 37 38 39 40 41 42 43 44 45 46
      CACHE STRING "The default version of SMTK to use if it cannot be detected")
    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
47
  superbuild_set_version_variables(paraview "5.6.0" "paraview-version.cmake" "version.txt")
48
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
T.J. Corona's avatar
T.J. Corona committed
49 50
  superbuild_set_version_variables(vtk "8.1.0" "vtk-version.cmake")
  set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
51 52 53
endmacro ()

function (superbuild_find_projects var)
54 55
  include(CMBSuperbuildMacros)

56 57 58 59
  set(projects
    boost
    bzip2
    cmb
60
    cmbusersguide
61
    cmbworkflows
62
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
63
    cxx11
64
    eigen
65
    fortran
66
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
67
    ftgl
68 69
    gdal
    hdf5
70
    lapack
T.J. Corona's avatar
T.J. Corona committed
71
    matplotlib
72 73
    moab
    netcdf
74
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
75
    numpy
Jacob Becker's avatar
Jacob Becker committed
76
    opencv
77
    paraview
78 79 80
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
81
    png
T.J. Corona's avatar
T.J. Corona committed
82
    pyarc
83
    pybind11
84
    python
85
    pythondiskcache
86 87
    pythongirderclient
    pythonrequests
88
    pythonrequeststoolbelt
89
    pythonsetuptools
90
    pythonsix
91
    qt
92
    qt4
93
    qt5
94 95
    remus
    smtk
96
    smtkusersguide
97
    szip
T.J. Corona's avatar
T.J. Corona committed
98
    vtk
99
    vtkonly
100 101 102 103
    vxl
    zeromq
    zlib)

104 105 106
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
107
      gperf
108 109 110
      libxml2)
  endif ()

111 112
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
113
      ftjam
114 115
      pythonsetuptools
      pywin32)
116 117
  endif ()

118 119 120 121 122
if (NOT DEVELOPER_MODE_smtk)
  list(APPEND projects
    smtkresourcemanagerstate)
  endif ()

123 124 125 126 127 128
  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
      triangle)
  endif ()
129

130 131 132 133
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
134

135
function (superbuild_sanity_check)
136
  if (vtkonly_enabled AND paraview_enabled)
T.J. Corona's avatar
T.J. Corona committed
137
    message(FATAL_ERROR
138
      "Only one of the following projects should be enabled: vtkonly, paraview.")
T.J. Corona's avatar
T.J. Corona committed
139
  endif ()
140 141 142 143
  if (NOT smtk_enabled AND NOT cmb_enabled)
    message(FATAL_ERROR
      "At least one of the following projects must be enabled: cmb, smtk.")
  endif ()
144 145 146
  if (smtk_enabled AND
      smtk_SOURCE_SELECTION STREQUAL "from_cmb" AND
      NOT DEVELOPER_MODE_smtk AND
147
      (NOT cmb_enabled OR DEVELOPER_MODE_cmb))
148 149 150
    message(WARNING
      "SMTK cannot use CMB's SMTK submodule without CMB being enabled and built by the superbuild. Pulling SMTK from git instead")
    set(smtk_SOURCE_SELECTION "git" CACHE STRING "smtk source selection" FORCE)
151
  endif ()
152 153
endfunction ()

154
function (superbuild_add_packaging)
155 156 157 158
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

159 160 161 162 163 164 165 166 167 168 169
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
170 171 172 173 174 175 176 177
  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)
  endif ()

178 179 180 181 182 183 184 185 186 187 188
  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 ()

189
  foreach (generator IN LISTS generators)
Ben Boeckel's avatar
Ben Boeckel committed
190 191
    superbuild_add_extra_package_test(modelbuilder "${generator}"
      LABELS  "CMB"
192
      TIMEOUT 6400)
193
  endforeach ()
194
endfunction ()
195

196 197
macro (superbuild_setup_tests)
  if (cmb_enabled)
198
    set(DROP_LOCATION "/submit.php?project=CMB")
199
  elseif (smtk_enabled)
200
    set(DROP_LOCATION "/submit.php?project=SMTK")
201 202 203
  endif ()
endmacro ()

204 205 206 207 208
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
209

210 211
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

Ben Boeckel's avatar
Ben Boeckel committed
212 213
# Default Qt5 to ON.
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
214

215 216 217 218 219 220 221 222 223 224 225 226
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

227
set(boost_minimum_version 1.64.0)
228 229 230 231 232
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
David Thompson's avatar
David Thompson committed
233
  log
234
  regex
235
  serialization
236
  system
David Thompson's avatar
David Thompson committed
237 238
  thread
  timer)
239

240 241 242 243 244
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

245 246 247 248
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

249 250 251 252 253 254 255 256 257
set(suppress_projects
  boost
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
  png
258
  pybind11
259 260 261 262 263 264 265 266
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

267 268
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
269
list(APPEND superbuild_ctest_custom_files
270 271 272 273
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)
274

275
if (TARGET "smtk" AND NOT DEVELOPER_MODE_smtk AND smtk_SOURCE_SELECTION STREQUAL "from_cmb")
276 277 278 279 280 281 282
  get_property(smtk_need_cmb_download GLOBAL
    PROPERTY smtk_need_cmb_download)
  if (smtk_need_cmb_download)
    add_dependencies("smtk"
      "cmb-download")
  endif ()
endif ()