CMakeLists.txt 5.85 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
  if (cmb_SOURCE_SELECTION STREQUAL "git")
11 12
    # 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.
13
    set(CMB_VERSION_DEFAULT "6.0.0-develop"
14 15 16 17
      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
18
    # If it is a git repo, we'll get it that way. Otherwise, we will look at the
19 20 21 22 23 24 25
    # `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")
26
  set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
27
  superbuild_set_version_variables(paraview "5.5.0" "paraview-version.cmake" "version.txt")
28
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
29 30
  superbuild_set_version_variables(vtk "8.1.0" "vtk-version.cmake")
  set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
31 32 33
endmacro ()

function (superbuild_find_projects var)
34 35
  include(CMBSuperbuildMacros)

36 37 38
  set(projects
    boost
    bzip2
Ben Boeckel's avatar
Ben Boeckel committed
39
    cgm
40
    cmb
41
    cmbusersguide
42
    cmbworkflows
43
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
44
    cxx11
45
    eigen
46
    fortran
47
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
48
    ftgl
49 50
    gdal
    hdf5
51
    lapack
T.J. Corona's avatar
T.J. Corona committed
52
    matplotlib
53 54
    moab
    netcdf
55
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
56
    numpy
Ben Boeckel's avatar
Ben Boeckel committed
57
    oce
58
    opencv
59
    paraview
60 61 62
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
63
    png
64
    pybind11
65
    python
66 67
    pythongirderclient
    pythonrequests
68
    pythonsetuptools
69
    pythonsix
70
    qt
71
    qt4
72
    qt5
73 74
    remus
    smtk
75
    smtkusersguide
76
    szip
77
    vtk
78
    vtkonly
79 80 81 82
    vxl
    zeromq
    zlib)

83 84 85
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
86
      gperf
87 88 89
      libxml2)
  endif ()

90 91
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
92
      ftjam
93 94
      pythonsetuptools
      pywin32)
95 96
  endif ()

97 98 99 100 101 102
  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 ()
103

104 105 106 107
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
108

109
function (superbuild_sanity_check)
110
  if (vtkonly_enabled AND paraview_enabled)
111
    message(FATAL_ERROR
112
      "Only one of the following projects should be enabled: vtkonly, paraview.")
113
  endif ()
114 115 116 117
  if (NOT smtk_enabled AND NOT cmb_enabled)
    message(FATAL_ERROR
      "At least one of the following projects must be enabled: cmb, smtk.")
  endif ()
118 119 120
  if (smtk_enabled AND
      smtk_SOURCE_SELECTION STREQUAL "from_cmb" AND
      NOT DEVELOPER_MODE_smtk AND
121 122 123 124
      (NOT cmb_enabled OR DEVELOPER_MODE_cmb))
    message(FATAL_ERROR
      "SMTK cannot use CMB's SMTK submodule without CMB being enabled and built by the superbuild.")
  endif ()
125 126
endfunction ()

127
function (superbuild_add_packaging)
128 129 130 131
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

132 133 134 135 136 137 138 139 140 141 142
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
143 144 145 146 147 148 149 150
  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 ()

151 152 153 154 155 156 157 158 159 160 161
  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 ()

162
  foreach (generator IN LISTS generators)
Ben Boeckel's avatar
Ben Boeckel committed
163 164
    superbuild_add_extra_package_test(modelbuilder "${generator}"
      LABELS  "CMB"
165
      TIMEOUT 6400)
166
  endforeach ()
167
endfunction ()
168

169 170
macro (superbuild_setup_tests)
  if (cmb_enabled)
171
    set(DROP_LOCATION "/submit.php?project=CMB")
172
  elseif (smtk_enabled)
173
    set(DROP_LOCATION "/submit.php?project=SMTK")
174 175 176
  endif ()
endmacro ()

177 178 179 180 181
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
182

183 184
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

Ben Boeckel's avatar
Ben Boeckel committed
185 186
# Default Qt5 to ON.
set(_superbuild_default_qt5 ON)
Ben Boeckel's avatar
Ben Boeckel committed
187

188 189 190 191 192 193 194 195 196 197 198 199
set(qt5_skip_modules
  qtconnectivity
  qtgamepad
  qtlocation
  qtmultimedia
  qtsensors
  qtserialport
  qtwayland
  qtwebchannel
  qtwebengine
  qtwebsockets)

200
set(boost_minimum_version 1.64.0)
201 202 203 204 205
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
David Thompson's avatar
David Thompson committed
206
  log
207
  regex
208
  serialization
209
  system
David Thompson's avatar
David Thompson committed
210 211
  thread
  timer)
212

213 214 215 216 217
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

218 219 220 221
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

222 223 224 225 226 227 228 229 230 231 232
set(suppress_projects
  boost
  cgm
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
  oce
  png
233
  pybind11
234 235 236 237 238 239 240 241
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

242 243
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
244
list(APPEND superbuild_ctest_custom_files
245 246 247 248
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)
249

250
if (TARGET "smtk" AND NOT DEVELOPER_MODE_smtk AND smtk_SOURCE_SELECTION STREQUAL "from_cmb")
251 252 253 254 255 256 257
  get_property(smtk_need_cmb_download GLOBAL
    PROPERTY smtk_need_cmb_download)
  if (smtk_need_cmb_download)
    add_dependencies("smtk"
      "cmb-download")
  endif ()
endif ()