CMakeLists.txt 4.49 KB
Newer Older
1
cmake_minimum_required(VERSION 2.8.11)
2

3 4
if (POLICY CMP0025)
  # Clang and AppleClang are now unique compiler ids
5
  cmake_policy(SET CMP0025 NEW)
6 7
endif ()

8 9
project(cmb-superbuild)

10 11 12
list(INSERT CMAKE_MODULE_PATH 0
  "${CMAKE_CURRENT_LIST_DIR}/cmake")

13 14
option(cmb_ENABLE_HYDROLOGY_PACKAGE "Build full hydrology package" ON)

15 16
macro (superbuild_setup_variables)
  include(SuperbuildVersionMacros)
17
  superbuild_set_version_variables(cmb "4.1.0-RC1" "cmb-version.cmake")
18
  set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
19
  superbuild_set_version_variables(paraview "5.4.0-RC1" "paraview-version.cmake")
20 21 22 23
  set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
endmacro ()

function (superbuild_find_projects var)
24 25
  include(CMBSuperbuildMacros)

26 27 28
  set(projects
    boost
    bzip2
Ben Boeckel's avatar
Ben Boeckel committed
29
    cgm
30
    cmb
31
    cmbusersguide
32
    cmbworkflows
33
    cumulus
Ben Boeckel's avatar
Ben Boeckel committed
34
    cxx11
35
    fortran
36
    freetype
Ben Boeckel's avatar
Ben Boeckel committed
37
    ftgl
38 39
    gdal
    hdf5
40
    lapack
41 42
    moab
    netcdf
Jacob Becker's avatar
Jacob Becker committed
43
    numpy
Ben Boeckel's avatar
Ben Boeckel committed
44
    oce
45
    opencv
46
    paraview
47 48 49
    paraviewweb
    paraviewwebvisualizer
    paraviewweblightviz
50
    png
51
    pybind11
52
    python
53 54
    pythongirderclient
    pythonrequests
55
    pythonsetuptools
56
    pythonsix
57
    qt
58
    qt4
59
    qt5
60 61 62
    remus
    shiboken
    smtk
63
    smtkusersguide
64 65 66 67 68
    szip
    vxl
    zeromq
    zlib)

69 70 71 72 73 74
  if (NOT WIN32)
    list(APPEND projects
      fontconfig
      libxml2)
  endif ()

75 76
  if (WIN32)
    list(APPEND projects
77
      ftjam
78 79
      pythonsetuptools
      pywin32)
80 81
  endif ()

82 83 84 85 86 87
  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 ()
88

89 90 91 92
  set("${var}"
    ${projects}
    PARENT_SCOPE)
endfunction ()
93

94 95 96 97 98
function (superbuild_sanity_check)
  if (NOT smtk_enabled AND NOT cmb_enabled)
    message(FATAL_ERROR
      "At least one of the following projects must be enabled: cmb, smtk.")
  endif ()
99 100 101 102 103 104 105 106 107 108 109 110
  if (shiboken_enabled AND pybind11_enabled)
    message(FATAL_ERROR
      "Only one python wrapping protocol should be enabled: pybind11, shiboken.")
  endif ()
  if (cmb_enabled AND NOT shiboken_enabled AND NOT pybind11_enabled)
    message(FATAL_ERROR
      "Exactly one python wrapping protocol must be enabled: pybind11, shiboken.")
  endif ()
  if (MSVC AND (MSVC_VERSION LESS 1900) AND pybind11_enabled)
    message(FATAL_ERROR
      "Visual Studio 2015 or later is required to use pybind11; use shiboken instead.")
  endif ()
111 112
endfunction ()

113
function (superbuild_add_packaging)
114 115 116 117
  if (NOT cmb_enabled OR DEVELOPER_MODE_cmb)
    return ()
  endif ()

118 119 120 121 122 123 124 125 126 127 128
  if (WIN32)
    set(generators
      ZIP)
  elseif (APPLE)
    set(generators
      DragNDrop)
  else ()
    set(generators
      TGZ)
  endif ()

129 130 131 132 133
  if (USE_SYSTEM_qt4)
    list(APPEND superbuild_export_variables
      QT_LIBRARY_DIR)
  endif ()

134
  foreach (generator IN LISTS generators)
Ben Boeckel's avatar
Ben Boeckel committed
135 136
    superbuild_add_extra_package_test(modelbuilder "${generator}"
      LABELS  "CMB"
137
      TIMEOUT 6400)
138 139 140 141 142 143

    if (cmb_ENABLE_HYDROLOGY_PACKAGE)
      superbuild_add_extra_package_test(hydrology "${generator}"
        LABELS  "CMB"
        TIMEOUT 6400)
    endif()
144
  endforeach ()
145
endfunction ()
146

147 148
macro (superbuild_setup_tests)
  if (cmb_enabled)
149
    set(DROP_LOCATION "/submit.php?project=CMB")
150
  elseif (smtk_enabled)
151
    set(DROP_LOCATION "/submit.php?project=SMTK")
152 153 154
  endif ()
endmacro ()

155 156 157 158 159
function (superbuild_add_tests)
  set_property(GLOBAL APPEND
    PROPERTY
      superbuild_test_projects cmb smtk)
endfunction ()
160

161 162
set(CMB_TEST_DATA_ROOT "" CACHE PATH "Location of CMB's testing data")

Ben Boeckel's avatar
Ben Boeckel committed
163 164 165
# Default Qt4 to ON.
set(_superbuild_default_qt4 ON)

166
set(boost_minimum_version 1.60.0)
167 168 169 170 171
set(boost_libraries
  atomic
  chrono
  date_time
  filesystem
172
  log
173
  regex
174
  system
175 176
  thread
  timer)
177

178 179 180 181 182
configure_file(
  "${CMAKE_CURRENT_LIST_DIR}/cmake/CTestCustom.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake"
  @ONLY)

183 184 185 186
if (__BUILDBOT_INSTALL_LOCATION)
  set(superbuild_install_location "${__BUILDBOT_INSTALL_LOCATION}")
endif ()

187 188 189 190 191 192 193 194 195 196 197
set(suppress_projects
  boost
  cgm
  freetype
  ftgl
  gdal
  hdf5
  netcdf
  numpy
  oce
  png
198
  pybind11
199 200 201 202 203 204 205 206 207
  shiboken
  szip
  vxl
  zeromq
  zlib)
foreach (suppress_project IN LISTS suppress_projects)
  set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()

208 209
list(APPEND superbuild_version_files
  "${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
210
list(APPEND superbuild_ctest_custom_files
211 212 213 214
  "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
  "${CMAKE_CURRENT_LIST_DIR}/projects")
add_subdirectory(superbuild)