CMakeLists.txt 6.83 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}")

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}")
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
T.J. Corona's avatar
T.J. Corona committed
79
    matplotlib
80 81
    moab
    netcdf
82
    nlohmannjson
Jacob Becker's avatar
Jacob Becker committed
83
    numpy
84
    opencv
85
    paraview
86 87 88
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
89
    png
T.J. Corona's avatar
T.J. Corona committed
90
    pyarc
91
    pybind11
92
    python
93
    pythondiskcache
94 95
    pythongirderclient
    pythonrequests
96
    pythonrequeststoolbelt
97
    pythonsetuptools
98
    pythonsix
99
    qt
100
    qt4
101
    qt5
102 103
    remus
    smtk
104
    smtkusersguide
105
    szip
106
    vtk
107
    vtkonly
108 109 110 111
    vxl
    zeromq
    zlib)

112 113 114
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
115
      gperf
116 117 118
      libxml2)
  endif ()

119 120
  if (WIN32)
    list(APPEND projects
Ben Boeckel's avatar
Ben Boeckel committed
121
      ftjam
122 123
      pythonsetuptools
      pywin32)
124 125
  endif ()

126 127 128
  if (NOT DEVELOPER_MODE_smtk)
    list(APPEND projects
      smtkresourcemanagerstate)
129
  endif ()
130 131
  # For now it's a convenient option to control smtk documentation
  option(ENABLE_DOCUMENTATION "Enable smtk documentation" ON)
132

133 134 135 136 137 138
  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 ()
139

140 141 142 143
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
144

145
function (superbuild_sanity_check)
146
  if (vtkonly_enabled AND paraview_enabled)
147
    message(FATAL_ERROR
148
      "Only one of the following projects should be enabled: vtkonly, paraview.")
149
  endif ()
150 151 152 153 154 155
  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 ()

156
function (superbuild_add_packaging)
157 158 159 160
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

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

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

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

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

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

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

212 213
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

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

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

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

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

247 248 249 250
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

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

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