smtk.cmake 5.03 KB
Newer Older
1 2
include(smtk-version)

3 4 5 6 7 8 9 10 11 12
set(smtk_extra_cmake_args)
if (WIN32)
  # On Windows we expect the Python source for module to be
  # in a different place than Unix builds and in a different
  # place than SMTK would put it by default. Tell SMTK where
  # to install Python source for the smtk module:
  list(APPEND smtk_extra_cmake_args
    "-DSMTK_PYTHON_MODULEDIR:PATH=bin/Lib/site-packages")
endif ()

13
set(smtk_enable_python_wrapping)
14
if (pybind11_enabled)
15 16 17
  set(smtk_enable_python_wrapping ON)
endif ()

18
set(smtk_enable_vtk OFF)
19
if (vtkonly_enabled OR paraview_enabled)
20 21 22
  set(smtk_enable_vtk ON)
endif ()

23
set (enable_smtk_doc always)
24
if (NOT ENABLE_DOCUMENTATION)
25 26 27
  set (enable_smtk_doc never)
endif()

28 29 30 31 32
if (UNIX AND NOT APPLE)
  list(APPEND smtk_extra_cmake_args
    -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=FALSE)
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
33
set(smtk_response_file)
34
if (WIN32)
Ben Boeckel's avatar
Ben Boeckel committed
35 36 37 38
  # Force response file usage in SMTK. The command line gets way too long on
  # Windows without this. Once VTK_USE_FILE and PARAVIEW_USE_FILE are gone,
  # this can be removed again.
  set(smtk_response_file -DCMAKE_NINJA_FORCE_RESPONSE_FILE:BOOL=ON)
39 40
endif ()

41 42 43
get_property(smtk_lfs_steps GLOBAL
  PROPERTY cmb_superbuild_lfs_steps)

44 45
#explicitly depend on gdal so we inherit the location of the GDAL library
#which FindGDAL.cmake fails to find, even when given GDAL_DIR.
46 47
superbuild_add_project(smtk
  DEVELOPER_MODE
48
  DEBUGGABLE
T.J. Corona's avatar
T.J. Corona committed
49
  DEFAULT_ON
50
  INDEPENDENT_STEP_TARGETS ${smtk_lfs_steps} download update
51
  DEPENDS boost cxx11 eigen hdf5 moab netcdf nlohmannjson
52
  DEPENDS_OPTIONAL cumulus gdal netcdf opencv paraview pybind11 python
53
                   matplotlib remus qt qt5 vtkonly vxl
54 55 56
  CMAKE_ARGS
    ${smtk_extra_cmake_args}
    -DBUILD_SHARED_LIBS:BOOL=ON
57
    -DSMTK_BUILD_DOCUMENTATION:STRING=${enable_smtk_doc}
Jacob Becker's avatar
Jacob Becker committed
58
    -DSMTK_ENABLE_OPENCV:BOOL=${opencv_enabled}
59 60
    -DSMTK_ENABLE_QT_SUPPORT:BOOL=${qt_enabled}
    -DSMTK_ENABLE_VTK_SUPPORT:BOOL=${smtk_enable_vtk}
61
    -DSMTK_ENABLE_VXL_SUPPORT:BOOL=${vxl_enabled}
62 63 64 65 66
    -DSMTK_ENABLE_PARAVIEW_SUPPORT:BOOL=${paraview_enabled}
    -DSMTK_ENABLE_DISCRETE_SESSION:BOOL=${smtk_enable_vtk}
    -DSMTK_ENABLE_EXODUS_SESSION:BOOL=${paraview_enabled}
    -DSMTK_ENABLE_REMOTE_SESSION:BOOL=${remus_enabled}
    -DSMTK_ENABLE_REMUS_SUPPORT:BOOL=${remus_enabled}
67
    -DSMTK_ENABLE_PYTHON_WRAPPING:BOOL=${smtk_enable_python_wrapping}
T.J. Corona's avatar
T.J. Corona committed
68
    -DSMTK_ENABLE_MATPLOTLIB:BOOL=${matplotlib_enabled}
69
    -DSMTK_USE_PYBIND11:BOOL=${pybind11_enabled}
70 71
    # SMTK_USE_SYSTEM_MOAB should go away after CMB's SMTK is bumped to master:
    -DSMTK_USE_SYSTEM_MOAB:BOOL=ON
72
    -DPYBIND11_INSTALL:BOOL=${pybind11_enabled}
73
    -DSMTK_QT_VERSION:STRING=5
74
    -DSMTK_DATA_DIR:PATH=${CMB_TEST_DATA_ROOT}
75

76 77 78
    # This should be off by default because vtkCmbMoabReader in discrete
    # session may only be needed for debugging purpose
    -DSMTK_ENABLE_MOAB_DISCRETE_READER:BOOL=OFF
79

80 81 82
    # GDAL bits to properly enable gdal classes ( mainly wrapper )
    # that we need to build
    -DGDAL_DIR:PATH=<INSTALL_DIR>
83

84 85 86
    # Cumulus bits
    -DSMTK_ENABLE_CUMULUS_SUPPORT:BOOL=${cumulus_enabled}

87 88 89
    # Set CMAKE_INSTALL_LIBDIR to "lib" for all projects in the superbuild to
    # override OS-specific libdirs that GNUInstallDirs.cmake would otherwise
    # set.
90 91
    -DCMAKE_INSTALL_LIBDIR:STRING=lib

Ben Boeckel's avatar
Ben Boeckel committed
92
    ${smtk_response_file})
93 94

if (WIN32)
95
  set(smtk_config_dir <INSTALL_DIR>/smtk/${smtk_version}/cmake)
96
else ()
97
  set(smtk_config_dir <INSTALL_DIR>/lib/cmake/smtk/${smtk_version})
98 99
endif ()

100
superbuild_add_extra_cmake_args(-Dsmtk_DIR:PATH=${smtk_config_dir})
101 102 103 104 105

if ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0") OR
    (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5"))
 superbuild_append_flags(cxx_flags "-Wno-inconsistent-missing-override" PROJECT_ONLY)
endif ()
106 107

set(smtk_can_lfs FALSE)
108
set(smtk_lfs_depends)
109 110
if (smtk_SOURCE_SELECTION STREQUAL "git")
  set(smtk_can_lfs TRUE)
111
elseif (smtk_SOURCE_SELECTION STREQUAL "source")
112
  if (EXISTS "${smtk_SOURCE_DIR}/.git")
113 114
    set(smtk_can_lfs TRUE)
  endif ()
115
elseif (smtk_SOURCE_SELECTION STREQUAL "from_cmb")
116
  if (EXISTS "${smtk_source_dir}/thirdparty/smtk/.git" OR
117
      cmb_SOURCE_SELECTION STREQUAL "git")
118 119
    set(smtk_can_lfs TRUE)
  endif ()
120 121 122 123 124 125 126 127 128 129 130 131
  if (cmb_SOURCE_SELECTION STREQUAL "git")
    # This is unfortunately necessary since the custom command is generated
    # deep in the common-superbuild/ExternalProject infrastructure. A more
    # proper solution would be to get the stamp file for each step and use
    # `add_custom_command(APPEND)` to amend the dependencies for the `lfs-init`
    # step to depend on the stamp file for the download step of CMB, but since
    # CMB's target has not yet been declared, we can't query it here and the
    # custom command doesn't exist at the top-level (where other `from_cmb`
    # logic exists.
    list(APPEND smtk_lfs_depends
      "${CMAKE_BINARY_DIR}/superbuild/cmb/stamp/cmb-download")
  endif ()
132 133 134
endif ()

option(smtk_FETCH_LFS "Fetch LFS data for CMB" OFF)
135
if (smtk_enabled AND smtk_can_lfs AND smtk_FETCH_LFS)
136
  cmb_superbuild_add_lfs_steps(smtk ${smtk_lfs_depends})
137
endif ()