smtk.cmake 4.39 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 ()

T.J. Corona's avatar
T.J. Corona committed
18
set(smtk_enable_vtk OFF)
19
if (vtkonly_enabled OR paraview_enabled)
T.J. Corona's avatar
T.J. Corona committed
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 ()

Ben Boeckel's avatar
Ben Boeckel committed
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 libarchive moab netcdf nlohmannjson pegtl
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_RELOCATABLE_INSTALL:BOOL=OFF
58
59
    -DBUILD_TESTING:BOOL=${BUILD_TESTING}
    -DSMTK_ENABLE_TESTING:BOOL=${TEST_smtk}
60
    -DSMTK_BUILD_DOCUMENTATION:STRING=${enable_smtk_doc}
Jacob Becker's avatar
Jacob Becker committed
61
    -DSMTK_ENABLE_OPENCV:BOOL=${opencv_enabled}
T.J. Corona's avatar
T.J. Corona committed
62
63
    -DSMTK_ENABLE_QT_SUPPORT:BOOL=${qt_enabled}
    -DSMTK_ENABLE_VTK_SUPPORT:BOOL=${smtk_enable_vtk}
64
    -DSMTK_ENABLE_VXL_SUPPORT:BOOL=${vxl_enabled}
T.J. Corona's avatar
T.J. Corona committed
65
66
67
68
69
    -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}
70
    -DSMTK_ENABLE_PYTHON_WRAPPING:BOOL=${smtk_enable_python_wrapping}
T.J. Corona's avatar
T.J. Corona committed
71
    -DSMTK_ENABLE_MATPLOTLIB:BOOL=${matplotlib_enabled}
72
    -DSMTK_USE_PYBIND11:BOOL=${pybind11_enabled}
73
74
    # SMTK_USE_SYSTEM_MOAB should go away after CMB's SMTK is bumped to master:
    -DSMTK_USE_SYSTEM_MOAB:BOOL=ON
75
    -DPYBIND11_INSTALL:BOOL=${pybind11_enabled}
76
    -DSMTK_QT_VERSION:STRING=5
77
    -DSMTK_DATA_DIR:PATH=${CMB_TEST_DATA_ROOT}
78

79
80
81
    # 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
82

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

87
88
89
    # Cumulus bits
    -DSMTK_ENABLE_CUMULUS_SUPPORT:BOOL=${cumulus_enabled}

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

Ben Boeckel's avatar
Ben Boeckel committed
95
    ${smtk_response_file})
96

97
set(smtk_config_version ${smtk_version_major}.${smtk_version_minor}.${smtk_version_patch})
98
if (WIN32)
99
  set(smtk_config_path "smtk/${smtk_config_version}/cmake")
100
else ()
101
  set(smtk_config_path "lib/cmake/smtk/${smtk_config_version}")
102
endif ()
103
superbuild_add_extra_cmake_args(-Dsmtk_DIR:PATH=<INSTALL_DIR>/${smtk_config_path})
104
105
106
107
108

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 ()
Ben Boeckel's avatar
Ben Boeckel committed
109
110

set(smtk_can_lfs FALSE)
111
set(smtk_lfs_depends)
Ben Boeckel's avatar
Ben Boeckel committed
112
113
if (smtk_SOURCE_SELECTION STREQUAL "git")
  set(smtk_can_lfs TRUE)
114
elseif (smtk_SOURCE_SELECTION STREQUAL "source")
115
  if (EXISTS "${smtk_SOURCE_DIR}/.git")
Ben Boeckel's avatar
Ben Boeckel committed
116
117
118
119
120
    set(smtk_can_lfs TRUE)
  endif ()
endif ()

option(smtk_FETCH_LFS "Fetch LFS data for CMB" OFF)
121
if (smtk_enabled AND smtk_can_lfs AND smtk_FETCH_LFS)
122
  cmb_superbuild_add_lfs_steps(smtk ${smtk_lfs_depends})
Ben Boeckel's avatar
Ben Boeckel committed
123
endif ()