CMakeLists.txt 5.46 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
    smtkonly
76
    smtkusersguide
77
    szip
78
    vtk
79
    vtkonly
80 81 82 83
    vxl
    zeromq
    zlib)

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

91 92
  if (WIN32)
    list(APPEND projects
93
      ftjam
94 95
      pythonsetuptools
      pywin32)
96 97
  endif ()

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

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

110
function (superbuild_sanity_check)
111
  if (vtkonly_enabled AND paraview_enabled)
112
    message(FATAL_ERROR
113
      "Only one of the following projects should be enabled: vtkonly, paraview.")
114
  endif ()
115
  if (smtkonly_enabled AND cmb_enabled)
116
    message(FATAL_ERROR
117
      "Only one of the following projects should be enabled: smtkonly, cmb.")
118
  endif ()
119
  if (NOT smtkonly_enabled AND NOT cmb_enabled)
120
    message(FATAL_ERROR
121
      "At least one of the following projects must be enabled: cmb, smtk.")
122
  endif ()
123 124
endfunction ()

125
function (superbuild_add_packaging)
126 127 128 129
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

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

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

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

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

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

175 176 177
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
178
      superbuild_test_projects cmb smtkonly)
179
endfunction ()
180

181 182
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

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

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

198
set(boost_minimum_version 1.64.0)
199 200 201 202 203
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
204
  log
205
  regex
206
  serialization
207
  system
208 209
  thread
  timer)
210

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

216 217 218 219
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

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

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