CMakeLists.txt 6.86 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
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
121
      ftjam
122 123
      pythonsetuptools
      pywin32)
124 125
  endif ()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

230
set(boost_minimum_version 1.64.0)
231 232 233 234 235
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
236
  log
237
  regex
238
  serialization
239
  system
240 241
  thread
  timer)
242

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

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

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

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