mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
0b03102b09
Use CMake's standard package discovery output and FeatureSummary instead of custom status messages, so configuration reports package availability, versions, and failure reasons consistently. Rename Ceres feature controls to use the WITH_ prefix to group them consistently and eliminate inconcistent naming. Remove retrospective cache updates so package discovery preserves caller-provided values and avoids unnecessary side effects. Fixes #876 Change-Id: Ib6e40d56a0ea89b292fe34554777593ffda95f42
903 lines
37 KiB
CMake
903 lines
37 KiB
CMake
# Ceres Solver - A fast non-linear least squares minimizer
|
|
# Copyright 2026 Google Inc. All rights reserved.
|
|
# http://ceres-solver.org/
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are met:
|
|
#
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
# this list of conditions and the following disclaimer.
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
# and/or other materials provided with the distribution.
|
|
# * Neither the name of Google Inc. nor the names of its contributors may be
|
|
# used to endorse or promote products derived from this software without
|
|
# specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
# Authors: keir@google.com (Keir Mierle)
|
|
# alexs.mac@gmail.com (Alex Stewart)
|
|
|
|
cmake_minimum_required(VERSION 3.22...4.4)
|
|
|
|
# NOTE: The 'generic' CMake variables CMAKE_[SOURCE/BINARY]_DIR should not be
|
|
# used. Always use the project-specific variants (generated by CMake):
|
|
# <PROJECT_NAME_MATCHING_CASE>_[SOURCE/BINARY]_DIR, e.g.
|
|
# Ceres_SOURCE_DIR (note, *not* CERES_SOURCE_DIR) instead, as these will
|
|
# always point to the correct directories for the Ceres project, even if
|
|
# it is nested inside another source tree, whereas the 'generic'
|
|
# CMake variables refer to the *first* project() declaration, i.e. the
|
|
# top-level project, not Ceres, if Ceres is nested.
|
|
|
|
# Make CMake aware of the cmake folder for local FindXXX scripts,
|
|
# append rather than set in case the user has passed their own
|
|
# additional paths via -D.
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
# Load the module early here to query Ceres' version. The remaining modules can
|
|
# be loaded later especially since some of them rely on enabled languages which
|
|
# is done by project() (and an explicit enable_language()).
|
|
include(ReadCeresVersionFromSource)
|
|
|
|
read_ceres_version_from_source(${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
project(Ceres
|
|
DESCRIPTION "A large scale non-linear optimization library"
|
|
HOMEPAGE_URL http://ceres-solver.org/
|
|
LANGUAGES C CXX
|
|
VERSION ${CERES_VERSION}
|
|
)
|
|
|
|
# Always build position-independent code (PIC), even when building Ceres as a
|
|
# static library so that shared libraries can link against it, not just
|
|
# executables (PIC does not apply on Windows). Global variable can be overridden
|
|
# by the user whereas target properties can be not.
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${Ceres_BINARY_DIR}/bin)
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${Ceres_BINARY_DIR}/lib)
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${Ceres_BINARY_DIR}/lib)
|
|
# Set postfixes for generated libraries based on buildtype.
|
|
set(CMAKE_RELEASE_POSTFIX "")
|
|
set(CMAKE_DEBUG_POSTFIX "-debug")
|
|
|
|
# Configure CMake checks and helper includes.
|
|
include(AddCompileFlagsIfSupported)
|
|
include(AddGerritCommitHook)
|
|
include(CeresCompileOptionsToComponents)
|
|
include(CheckCXXCompilerFlag)
|
|
include(CheckLibraryExists)
|
|
include(CMakeDependentOption)
|
|
include(CMakePackageConfigHelpers)
|
|
include(CreateCeresConfig)
|
|
include(DetectBrokenStackCheckMacOSXcodePairing)
|
|
include(EnableSanitizer)
|
|
include(FeatureSummary)
|
|
include(GNUInstallDirs)
|
|
include(PrettyPrintCMakeList)
|
|
|
|
function(ceres_register_found_package PACKAGE_NAME)
|
|
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND "${PACKAGE_NAME}")
|
|
endfunction()
|
|
|
|
# Ceres configuration options.
|
|
option(BUILD_BENCHMARKS "Build Ceres benchmarking suite" ON)
|
|
option(BUILD_DOCUMENTATION "Build User's Guide (html)" OFF)
|
|
cmake_dependent_option(BUILD_EXAMPLES "Build examples" ON "NOT IOS" OFF)
|
|
option(BUILD_SHARED_LIBS "Build Ceres as a shared library." OFF)
|
|
option(BUILD_TESTING "Enable tests" ON)
|
|
cmake_dependent_option(WITH_ACCELERATESPARSE
|
|
"Enable use of sparse solvers in Apple's Accelerate framework." ON
|
|
APPLE OFF)
|
|
cmake_dependent_option(WITH_BITCODE
|
|
"Enable bitcode for iOS builds (disables inline optimizations for Eigen)." OFF
|
|
IOS OFF)
|
|
set(WITH_CUDA "default" CACHE STRING
|
|
"Enable use of CUDA linear algebra solvers.")
|
|
option(WITH_CUSTOM_BLAS
|
|
"Use handcoded BLAS routines (usually faster) instead of Eigen." ON)
|
|
cmake_dependent_option(WITH_EIGENMETIS "Enable Eigen METIS support." ON
|
|
"NOT DEFINED WITH_EIGENSPARSE OR WITH_EIGENSPARSE" OFF)
|
|
# The controlling option is declared later and defaults to ON.
|
|
option(WITH_EIGENSPARSE
|
|
"Enable Eigen as a sparse linear algebra library." ON)
|
|
# Apple considers the BLAS dsyrk_ symbol a private API and rejects iOS apps
|
|
# that contain it.
|
|
cmake_dependent_option(WITH_LAPACK
|
|
"Enable use of LAPACK directly within Ceres." ON "NOT IOS" OFF)
|
|
set(WITH_SANITIZERS "" CACHE STRING
|
|
"Semicolon-separated list of sanitizers to use (e.g address, memory, thread)")
|
|
option(WITH_SCHUR_SPECIALIZATIONS
|
|
"Enable fixed-size schur specializations." ON)
|
|
cmake_dependent_option(WITH_STRIPPED_DEBUG_SYMBOLS
|
|
"Strip debug symbols from Android builds (reduces file sizes)" ON
|
|
ANDROID OFF)
|
|
option(WITH_SUITESPARSE "Enable SuiteSparse." OFF)
|
|
option(WITH_UNINSTALL_TARGET
|
|
"Add a custom target to ease removal of installed targets" ON)
|
|
|
|
set_property(CACHE WITH_CUDA PROPERTY STRINGS OFF default static)
|
|
|
|
# Discover dependencies.
|
|
if (NOT EXISTS "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/CMakeLists.txt")
|
|
find_package(absl REQUIRED 20240116)
|
|
endif()
|
|
find_package(AccelerateSparse)
|
|
# Version 1.3 was first to provide import targets.
|
|
find_package(benchmark 1.3)
|
|
find_package(BLAS)
|
|
find_package(LAPACK)
|
|
find_package(CUDAToolkit)
|
|
find_package(cudss NO_MODULE)
|
|
|
|
# Eigen3's CMake package prior to version 5.0.0 does not support version
|
|
# ranges with different major version components.
|
|
set (_Ceres_Eigen3_DIR)
|
|
if (Eigen3_DIR)
|
|
set (_Ceres_Eigen3_DIR "${Eigen3_DIR}")
|
|
endif (Eigen3_DIR)
|
|
|
|
find_package(Eigen3 3.3.4...5 NO_MODULE)
|
|
if (NOT Eigen3_FOUND)
|
|
if (_Ceres_Eigen3_DIR)
|
|
set (Eigen3_DIR "${_Ceres_Eigen3_DIR}")
|
|
endif (_Ceres_Eigen3_DIR)
|
|
find_package(Eigen3 3.3.4 REQUIRED NO_MODULE)
|
|
endif (NOT Eigen3_FOUND)
|
|
unset (_Ceres_Eigen3_DIR)
|
|
|
|
if (NOT EXISTS "${Ceres_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
|
|
find_package(GTest 1.14.0)
|
|
endif()
|
|
|
|
find_package(METIS)
|
|
find_package(Sphinx COMPONENTS sphinx_rtd_theme)
|
|
# Ubuntu 22.04 provides SuiteSparse 5.10.1, which remains supported.
|
|
find_package(SuiteSparse 4.5.6 COMPONENTS CHOLMOD SPQR
|
|
OPTIONAL_COMPONENTS Partition)
|
|
find_package(Threads REQUIRED)
|
|
|
|
# Show dependencies in importance order in the CMake feature summary.
|
|
set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES
|
|
REQUIRED RECOMMENDED OPTIONAL)
|
|
|
|
check_cxx_compiler_flag(/bigobj HAVE_BIGOBJ)
|
|
# Ceres C++ compiler flags can be too strict for an external library code
|
|
# which we do not maintain.
|
|
check_cxx_compiler_flag("-Wno-missing-declarations"
|
|
CHECK_CXX_FLAG_Wno_missing_declarations)
|
|
# Older versions of Clang (<= 2.9) do not support the 'return-type-c-linkage'
|
|
# option, so check for its presence before adding it to the default flags set.
|
|
check_cxx_compiler_flag("-Wno-return-type-c-linkage"
|
|
HAVE_RETURN_TYPE_C_LINKAGE)
|
|
check_library_exists(m pow "" HAVE_LIBM)
|
|
|
|
detect_broken_stack_check_macos_xcode_pairing()
|
|
enable_sanitizer(${WITH_SANITIZERS})
|
|
|
|
if (BUILD_TESTING)
|
|
enable_testing()
|
|
endif()
|
|
|
|
# Set up the git hook to make Gerrit Change-Id: lines in commit messages.
|
|
add_gerrit_commit_hook(${Ceres_SOURCE_DIR} ${Ceres_BINARY_DIR})
|
|
|
|
# Abseil
|
|
if (EXISTS "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/CMakeLists.txt")
|
|
# extract submodule absl_VERSION
|
|
file(STRINGS "${Ceres_SOURCE_DIR}/third_party/abseil-cpp/CMakeLists.txt" project_calls REGEX "[ \t]*project\\([ \t]*absl")
|
|
foreach(project_call IN LISTS project_calls)
|
|
string(REGEX MATCH "VERSION[ ]+([0-9]+(\.(rc)?[0-9]+)?)" version_param "${project_call}")
|
|
if (version_param)
|
|
set(absl_VERSION "${CMAKE_MATCH_1}")
|
|
break ()
|
|
endif()
|
|
endforeach()
|
|
unset(project_calls)
|
|
unset(project_call)
|
|
unset(version_param)
|
|
# In the normal course of things, we would not need the following constraint.
|
|
# However, if we do not set the standard, then std::basic_string_view is not
|
|
# available, which absl depends on and linking the test fails.
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
# Abseil does not handle symbol visibility correctly. As a workaround, we let it
|
|
# expose all the symbols to avoid linker errors.
|
|
set(CMAKE_CXX_VISIBILITY_PRESET default)
|
|
# ABSL plans to enable this flag to be on by default in the future. If it is not
|
|
# set, then it issues a warning. We force enable it, both to silence the warning
|
|
# but to also be safe going forward.
|
|
|
|
option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features
|
|
(e.g. cxx_std_14) that propagate to targets that link to Abseil" ON)
|
|
option(ABSL_ENABLE_INSTALL "Enable install rules" ON)
|
|
|
|
add_subdirectory(third_party/abseil-cpp)
|
|
export(EXPORT abslTargets
|
|
FILE "${Ceres_BINARY_DIR}/third_party/abseil-cpp/abslTargets.cmake"
|
|
NAMESPACE absl::)
|
|
set(absl_FOUND TRUE)
|
|
ceres_register_found_package(absl)
|
|
|
|
unset(CMAKE_CXX_STANDARD)
|
|
unset(CMAKE_CXX_VISIBILITY_PRESET)
|
|
|
|
# Set the default symbol visibility to hidden to unify the behavior among
|
|
# the various compilers and to get smaller binaries
|
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
|
|
set(CERES_USE_SYSTEM_ABSL NO)
|
|
else()
|
|
if (NOT absl_VERSION)
|
|
# In some installs, abseil will not export the version number, in
|
|
# which case we check for vlog_is_on, which is a feature we need
|
|
# before being able to use abseil.
|
|
if (NOT TARGET absl::absl_vlog_is_on)
|
|
message(FATAL_ERROR "The version of abseil installed on the system provides no version info and is missing TARGET 'absl::absl_vlog_is_on', need at least 20240116")
|
|
endif()
|
|
endif()
|
|
set(CERES_USE_SYSTEM_ABSL YES)
|
|
endif()
|
|
if (NOT absl_VERSION)
|
|
install (CODE [=[message (FATAL_ERROR "Cannot generate CeresConfig.cmake due to missing Abseil version. Using resulting package configuration will likely result in integration errors. Set absl_VERSION manually to disable this error message.")]=])
|
|
endif()
|
|
|
|
# Google Test
|
|
if (BUILD_TESTING)
|
|
if (EXISTS "${Ceres_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
|
|
file(STRINGS "${Ceres_SOURCE_DIR}/third_party/googletest/CMakeLists.txt"
|
|
googletest_version_lines REGEX "set\\([ \\t]*GOOGLETEST_VERSION")
|
|
foreach(googletest_version_line IN LISTS googletest_version_lines)
|
|
string(REGEX MATCH "GOOGLETEST_VERSION[ \\t]+([0-9]+(\\.[0-9]+)+)"
|
|
googletest_version_match "${googletest_version_line}")
|
|
if (googletest_version_match)
|
|
set(GOOGLETEST_VERSION "${CMAKE_MATCH_1}")
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
unset(googletest_version_lines)
|
|
unset(googletest_version_line)
|
|
unset(googletest_version_match)
|
|
# Now that we have absl as a dependency, it would make sense to tell
|
|
# googletest to use absl also, but doing so seems to be problematic
|
|
# for now, since if there is a version of absl and re2 installed in
|
|
# the system then we start getting errors because we maybe using the
|
|
# absl from our submodule, but the re2 installed on the system only
|
|
# sees the absl installed on the system. It is possible that we will
|
|
# need to include re2 as a submodule also, for the following to
|
|
# work.
|
|
|
|
# set(GTEST_HAS_ABSL ON CACHE BOOL "Use ABSL when building gtest")
|
|
add_subdirectory(${Ceres_SOURCE_DIR}/third_party/googletest ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/googletest)
|
|
set(GTest_FOUND TRUE)
|
|
ceres_register_found_package(GTest)
|
|
else()
|
|
if (NOT GTest_FOUND)
|
|
message(FATAL_ERROR "GoogleTest 1.14.0 or newer is required to build tests")
|
|
endif()
|
|
set(GOOGLETEST_VERSION "${GTest_VERSION}")
|
|
endif()
|
|
endif(BUILD_TESTING)
|
|
|
|
# IOS is defined iff using the iOS.cmake CMake toolchain to build a static
|
|
# library for iOS.
|
|
if (IOS)
|
|
message(VERBOSE "Building Ceres for iOS platform: ${IOS_PLATFORM}")
|
|
|
|
# Ceres requires at least iOS 7.0+.
|
|
if (IOS_DEPLOYMENT_TARGET VERSION_LESS 7.0)
|
|
message(FATAL_ERROR "Unsupported iOS version: ${IOS_DEPLOYMENT_TARGET}, Ceres "
|
|
"requires at least iOS version 7.0")
|
|
endif()
|
|
endif (IOS)
|
|
|
|
# Compute effective feature states once so build configuration and the summary
|
|
# cannot disagree about which optional components are available.
|
|
set(_Ceres_FEATURE_ACCELERATE OFF)
|
|
if (WITH_ACCELERATESPARSE AND AccelerateSparse_FOUND)
|
|
set(_Ceres_FEATURE_ACCELERATE ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_CUDA OFF)
|
|
if (WITH_CUDA AND CUDAToolkit_FOUND)
|
|
set(_Ceres_FEATURE_CUDA ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_CUDSS OFF)
|
|
if (_Ceres_FEATURE_CUDA AND cudss_FOUND)
|
|
set(_Ceres_FEATURE_CUDSS ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_EIGEN_METIS OFF)
|
|
if (WITH_EIGENMETIS AND METIS_FOUND)
|
|
set(_Ceres_FEATURE_EIGEN_METIS ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_EIGEN_SPARSE OFF)
|
|
if (WITH_EIGENSPARSE AND Eigen3_FOUND)
|
|
set(_Ceres_FEATURE_EIGEN_SPARSE ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_LAPACK OFF)
|
|
if (WITH_LAPACK AND LAPACK_FOUND)
|
|
set(_Ceres_FEATURE_LAPACK ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_SUITESPARSE OFF)
|
|
if (WITH_SUITESPARSE AND SuiteSparse_FOUND)
|
|
set(_Ceres_FEATURE_SUITESPARSE ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_CHOLMOD_PARTITION OFF)
|
|
if (_Ceres_FEATURE_SUITESPARSE AND SuiteSparse_Partition_FOUND)
|
|
set(_Ceres_FEATURE_CHOLMOD_PARTITION ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_DOCUMENTATION OFF)
|
|
if (BUILD_DOCUMENTATION AND Sphinx_FOUND)
|
|
set(_Ceres_FEATURE_DOCUMENTATION ON)
|
|
endif()
|
|
|
|
set(_Ceres_FEATURE_BENCHMARKS OFF)
|
|
if (BUILD_BENCHMARKS AND benchmark_FOUND)
|
|
set(_Ceres_FEATURE_BENCHMARKS ON)
|
|
endif()
|
|
|
|
set(WITH_CHOLMOD_FLOAT OFF)
|
|
if (_Ceres_FEATURE_SUITESPARSE AND
|
|
SuiteSparse_VERSION VERSION_GREATER_EQUAL 7.4.0)
|
|
set(WITH_CHOLMOD_FLOAT ON)
|
|
endif()
|
|
|
|
unset(CERES_COMPILE_OPTIONS)
|
|
|
|
if (_Ceres_FEATURE_EIGEN_SPARSE)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_USE_EIGEN_SPARSE)
|
|
else()
|
|
add_definitions(-DEIGEN_MPL2_ONLY)
|
|
endif()
|
|
|
|
if (_Ceres_FEATURE_CUDA)
|
|
set(CUDAToolkit_DEPENDENCY
|
|
"find_dependency(CUDAToolkit ${CUDAToolkit_VERSION})")
|
|
enable_language(CUDA)
|
|
set(CMAKE_CUDA_ARCHITECTURES "")
|
|
if (CUDAToolkit_VERSION VERSION_LESS "13.0")
|
|
# Support Maxwell GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "50")
|
|
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
|
|
# Support Pascal GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "60")
|
|
endif()
|
|
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
|
|
# Support Volta GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "70")
|
|
endif()
|
|
endif()
|
|
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "10.0")
|
|
# Support Turing GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "75")
|
|
endif()
|
|
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.0")
|
|
# Support Ampere GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "80")
|
|
endif()
|
|
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "12.0")
|
|
# Support Hopper GPUs.
|
|
list(APPEND CMAKE_CUDA_ARCHITECTURES "90")
|
|
endif()
|
|
|
|
if (WITH_CUDA STREQUAL "static")
|
|
set(CERES_CUDA_TARGET_SUFFIX "_static")
|
|
else()
|
|
set(CERES_CUDA_TARGET_SUFFIX "")
|
|
endif()
|
|
list(APPEND CERES_CUDA_LIBRARIES
|
|
CUDA::cublas${CERES_CUDA_TARGET_SUFFIX}
|
|
CUDA::cudart${CERES_CUDA_TARGET_SUFFIX}
|
|
CUDA::cusolver${CERES_CUDA_TARGET_SUFFIX}
|
|
CUDA::cusparse${CERES_CUDA_TARGET_SUFFIX})
|
|
|
|
if (_Ceres_FEATURE_CUDSS)
|
|
set(cudss_DEPENDENCY "find_dependency(cudss ${cudss_VERSION})")
|
|
list(APPEND CERES_CUDA_LIBRARIES cudss${CERES_CUDA_TARGET_SUFFIX})
|
|
else()
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDSS)
|
|
endif()
|
|
|
|
unset (CERES_CUDA_TARGET_SUFFIX)
|
|
set(CMAKE_CUDA_RUNTIME_LIBRARY NONE)
|
|
else()
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDSS)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDA)
|
|
endif()
|
|
|
|
if (NOT _Ceres_FEATURE_LAPACK)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_LAPACK)
|
|
endif()
|
|
|
|
# Set the install path for the installed CeresConfig.cmake configuration file
|
|
# relative to CMAKE_INSTALL_PREFIX.
|
|
set(RELATIVE_CMAKECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/Ceres)
|
|
set(_Ceres_CONFIG_DEPENDENCY_MODULES)
|
|
|
|
if (_Ceres_FEATURE_SUITESPARSE)
|
|
# SuiteSparse support is opt-in and was explicitly requested. If it and
|
|
# all of its dependencies are found, Ceres is built with SuiteSparse
|
|
# support.
|
|
|
|
set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
|
|
if (NOT WITH_CHOLMOD_FLOAT)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CHOLMOD_FLOAT)
|
|
endif()
|
|
if (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
|
|
list(APPEND _Ceres_CONFIG_DEPENDENCY_MODULES
|
|
${Ceres_SOURCE_DIR}/cmake/FindSuiteSparse.cmake
|
|
${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake)
|
|
endif (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
|
|
else()
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_SUITESPARSE)
|
|
endif()
|
|
|
|
if (NOT _Ceres_FEATURE_CHOLMOD_PARTITION)
|
|
list (APPEND CERES_COMPILE_OPTIONS CERES_NO_CHOLMOD_PARTITION)
|
|
endif()
|
|
|
|
if (_Ceres_FEATURE_EIGEN_METIS)
|
|
# Since METIS is a private dependency of Ceres, it requires access to the
|
|
# link-only METIS::METIS target to avoid undefined linker errors in projects
|
|
# relying on Ceres. We do not actually need to propagate anything besides
|
|
# the link libraries (such as include directories.)
|
|
set(METIS_DEPENDENCY "find_dependency(METIS ${METIS_VERSION})")
|
|
# METIS find module must be installed unless a package config is being used.
|
|
if (NOT METIS_DIR)
|
|
list(APPEND _Ceres_CONFIG_DEPENDENCY_MODULES
|
|
${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake)
|
|
endif (NOT METIS_DIR)
|
|
else()
|
|
list (APPEND CERES_COMPILE_OPTIONS CERES_NO_EIGEN_METIS)
|
|
endif()
|
|
|
|
if (NOT _Ceres_FEATURE_ACCELERATE)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_ACCELERATE_SPARSE)
|
|
mark_as_advanced(FORCE AccelerateSparse_INCLUDE_DIR
|
|
AccelerateSparse_LIBRARY)
|
|
endif()
|
|
|
|
# ANDROID define is set by the Android CMake toolchain file.
|
|
if (ANDROID)
|
|
if (WITH_STRIPPED_DEBUG_SYMBOLS)
|
|
# Strip debug information unconditionally to avoid +200MB library file sizes.
|
|
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s" )
|
|
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s" )
|
|
endif()
|
|
endif()
|
|
|
|
if (NOT WITH_SCHUR_SPECIALIZATIONS)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_RESTRICT_SCHUR_SPECIALIZATION)
|
|
endif (NOT WITH_SCHUR_SPECIALIZATIONS)
|
|
|
|
if (NOT WITH_CUSTOM_BLAS)
|
|
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUSTOM_BLAS)
|
|
endif (NOT WITH_CUSTOM_BLAS)
|
|
|
|
# Change the default build type from Debug to Release, while still
|
|
# supporting overriding the build type.
|
|
#
|
|
# The CACHE STRING logic here and elsewhere is needed to force CMake
|
|
# to pay attention to the value of these variables.
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
message(STATUS "No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.")
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
FORCE)
|
|
else (NOT CMAKE_BUILD_TYPE)
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
message(STATUS "\n=================================================================================")
|
|
message(STATUS "\nBuild type: Debug. Performance will be terrible!")
|
|
message(STATUS "Add -DCMAKE_BUILD_TYPE=Release to the CMake command line to get an optimized build.")
|
|
message(STATUS "\n=================================================================================")
|
|
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
endif (NOT CMAKE_BUILD_TYPE)
|
|
|
|
# After the tweaks for the compile settings, disable some warnings on MSVC.
|
|
if (MSVC)
|
|
# Insecure standard library functions
|
|
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
|
|
# std::numeric_limits<T>::has_denorm is deprecated in C++23
|
|
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_SILENCE_CXX23_DENORM_DEPRECATION_WARNING>)
|
|
# std::aligned_storage is deprecated in C++23
|
|
add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:_SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING>)
|
|
# Disable signed/unsigned int conversion warnings.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4018>)
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4267>)
|
|
# Disable warning about using struct/class for the same symbol.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4099>)
|
|
# Disable performance warning about int-to-bool conversion.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4800>)
|
|
# Disable warning about int64 to int32 conversion. Disabling
|
|
# this warning may not be correct; needs investigation.
|
|
# TODO(keir): Investigate these warnings in more detail.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4244>)
|
|
# It's not possible to use STL types in DLL interfaces in a portable and
|
|
# reliable way. However, that's what happens with Google Log and Google Flags
|
|
# on Windows. MSVC gets upset about this and throws warnings that we can't do
|
|
# much about. The real solution is to link static versions of Google Log and
|
|
# Google Test, but that seems tricky on Windows. So, disable the warning.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/wd4251>)
|
|
|
|
# Add bigobj flag otherwise the build would fail due to large object files
|
|
# probably resulting from generated headers (like the fixed-size schur
|
|
# specializations).
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
|
|
|
|
# Google Flags doesn't have their DLL import/export stuff set up correctly,
|
|
# which results in linker warnings. This is irrelevant for Ceres, so ignore
|
|
# the warnings.
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4049")
|
|
|
|
# Tuple sizes of 10 are used by Gtest.
|
|
add_definitions("-D_VARIADIC_MAX=10")
|
|
endif (MSVC)
|
|
|
|
if (UNIX)
|
|
# Flags which we add to GCC to make it more picky about stuff
|
|
# we do care about,
|
|
add_cxx_compiler_flag_if_supported(CERES_STRICT_CXX_FLAGS
|
|
-Wmissing-declarations)
|
|
# Flags which we add to GCC to silence lots of annoying false-positives.
|
|
add_cxx_compiler_flag_if_supported(CERES_STRICT_CXX_FLAGS
|
|
-Wno-unknown-pragmas)
|
|
add_cxx_compiler_flag_if_supported(CERES_STRICT_CXX_FLAGS
|
|
-Wno-sign-compare)
|
|
add_cxx_compiler_flag_if_supported(CERES_STRICT_CXX_FLAGS
|
|
-Wno-unused-parameter)
|
|
add_cxx_compiler_flag_if_supported(CERES_STRICT_CXX_FLAGS
|
|
-Wno-missing-field-initializers)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CERES_STRICT_CXX_FLAGS}")
|
|
endif (UNIX)
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Matches Clang & AppleClang.
|
|
# Optimize for Eigen OR enable bitcode; you cannot do both since bitcode is an
|
|
# intermediate representation.
|
|
if (WITH_BITCODE)
|
|
set(CMAKE_CXX_FLAGS
|
|
"${CMAKE_CXX_FLAGS} -fembed-bitcode")
|
|
else ()
|
|
# Use a larger inlining threshold for Clang, since it hobbles Eigen,
|
|
# resulting in an unreasonably slow version of the blas routines. The
|
|
# -Qunused-arguments is needed because CMake passes the inline
|
|
# threshold to the linker and clang complains about it and dies.
|
|
set(CMAKE_CXX_FLAGS
|
|
"${CMAKE_CXX_FLAGS} -Qunused-arguments -mllvm -inline-threshold=600")
|
|
endif ()
|
|
if (HAVE_RETURN_TYPE_C_LINKAGE)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
|
|
endif(HAVE_RETURN_TYPE_C_LINKAGE)
|
|
endif ()
|
|
|
|
add_compile_definitions($<$<BOOL:${WIN32}>:NOMINMAX>)
|
|
|
|
# Configure the Ceres config.h compile options header using the current
|
|
# compile options and put the configured header into the Ceres build
|
|
# directory. Note that the ceres/internal subdir in <build>/config where
|
|
# the configured config.h is placed is important, because Ceres will be
|
|
# built against this configured header, it needs to have the same relative
|
|
# include path as it would if it were in the source tree (or installed).
|
|
list(REMOVE_DUPLICATES CERES_COMPILE_OPTIONS)
|
|
create_ceres_config("${CERES_COMPILE_OPTIONS}"
|
|
${Ceres_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/ceres/internal)
|
|
|
|
add_subdirectory(internal/ceres)
|
|
|
|
if (_Ceres_FEATURE_DOCUMENTATION)
|
|
# Generate the User's Guide (html).
|
|
# The corresponding target is ceres_docs, but is included in ALL.
|
|
add_subdirectory(docs)
|
|
endif (_Ceres_FEATURE_DOCUMENTATION)
|
|
|
|
if (BUILD_EXAMPLES)
|
|
add_subdirectory(examples)
|
|
endif (BUILD_EXAMPLES)
|
|
|
|
# Setup installation of Ceres public headers.
|
|
file(GLOB CERES_HDRS ${Ceres_SOURCE_DIR}/include/ceres/*.h)
|
|
install(FILES ${CERES_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ceres)
|
|
|
|
file(GLOB CERES_PUBLIC_INTERNAL_HDRS ${Ceres_SOURCE_DIR}/include/ceres/internal/*.h)
|
|
install(FILES ${CERES_PUBLIC_INTERNAL_HDRS} DESTINATION
|
|
${CMAKE_INSTALL_INCLUDEDIR}/ceres/internal)
|
|
|
|
# Also setup installation of Ceres config.h configured with the current
|
|
# build options and export.h into the installed headers directory.
|
|
install(DIRECTORY ${Ceres_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
|
|
|
# Ceres supports two mechanisms by which it can be detected & imported into
|
|
# client code which uses CMake via find_package(Ceres):
|
|
#
|
|
# 1) Installation (e.g. to /usr/local), using CMake's install() function.
|
|
#
|
|
# 2) (Optional) Export of the current build directory into the local CMake
|
|
# package registry, using CMake's export() function. This allows use of
|
|
# Ceres from other projects without requiring installation.
|
|
#
|
|
# In both cases, we need to generate a configured CeresConfig.cmake which
|
|
# includes additional autogenerated files which in concert create an imported
|
|
# target for Ceres in a client project when find_package(Ceres) is invoked.
|
|
# The key distinctions are where this file is located, and whether client code
|
|
# references installed copies of the compiled Ceres headers/libraries,
|
|
# (option #1: installation), or the originals in the source/build directories
|
|
# (option #2: export of build directory).
|
|
#
|
|
# NOTE: If Ceres is both exported and installed, provided that the installation
|
|
# path is present in CMAKE_MODULE_PATH when find_package(Ceres) is called,
|
|
# the installed version is preferred.
|
|
|
|
# Build the list of Ceres components for CeresConfig.cmake from the current set
|
|
# of compile options.
|
|
ceres_compile_options_to_components("${CERES_COMPILE_OPTIONS}"
|
|
CERES_COMPILED_COMPONENTS)
|
|
|
|
# Make dependency modules available relative to the package config.
|
|
list(REMOVE_DUPLICATES _Ceres_CONFIG_DEPENDENCY_MODULES)
|
|
set(_Ceres_FIND_MODULES
|
|
"${Ceres_SOURCE_DIR}/cmake/FindAccelerateSparse.cmake"
|
|
"${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake"
|
|
"${Ceres_SOURCE_DIR}/cmake/FindSphinx.cmake"
|
|
"${Ceres_SOURCE_DIR}/cmake/FindSuiteSparse.cmake")
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
|
|
${_Ceres_FIND_MODULES})
|
|
set(_Ceres_FIND_MODULES_LINK "${Ceres_BINARY_DIR}/CeresFindModules")
|
|
if (IS_SYMLINK "${_Ceres_FIND_MODULES_LINK}")
|
|
file(REMOVE "${_Ceres_FIND_MODULES_LINK}")
|
|
elseif(EXISTS "${_Ceres_FIND_MODULES_LINK}"
|
|
AND NOT IS_DIRECTORY "${_Ceres_FIND_MODULES_LINK}")
|
|
message(FATAL_ERROR
|
|
"CeresFindModules exists but is not a directory: "
|
|
"${_Ceres_FIND_MODULES_LINK}")
|
|
endif()
|
|
file(MAKE_DIRECTORY "${_Ceres_FIND_MODULES_LINK}")
|
|
foreach(_Ceres_FIND_MODULE IN LISTS _Ceres_FIND_MODULES)
|
|
get_filename_component(_Ceres_FIND_MODULE_NAME
|
|
"${_Ceres_FIND_MODULE}" NAME)
|
|
file(CREATE_LINK
|
|
"${_Ceres_FIND_MODULE}"
|
|
"${_Ceres_FIND_MODULES_LINK}/${_Ceres_FIND_MODULE_NAME}"
|
|
SYMBOLIC COPY_ON_ERROR
|
|
RESULT _Ceres_FIND_MODULE_LINK_RESULT)
|
|
if (_Ceres_FIND_MODULE_LINK_RESULT)
|
|
message(FATAL_ERROR
|
|
"Creating the link for '${_Ceres_FIND_MODULE}' returned "
|
|
"'${_Ceres_FIND_MODULE_LINK_RESULT}', expected '0'")
|
|
endif()
|
|
endforeach()
|
|
if (_Ceres_CONFIG_DEPENDENCY_MODULES)
|
|
install(FILES ${_Ceres_CONFIG_DEPENDENCY_MODULES}
|
|
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
|
|
endif()
|
|
unset(_Ceres_CONFIG_DEPENDENCY_MODULES)
|
|
unset(_Ceres_FIND_MODULE)
|
|
unset(_Ceres_FIND_MODULE_LINK_RESULT)
|
|
unset(_Ceres_FIND_MODULE_NAME)
|
|
unset(_Ceres_FIND_MODULES)
|
|
unset(_Ceres_FIND_MODULES_LINK)
|
|
|
|
|
|
# Create a CeresConfigVersion.cmake file containing the version information,
|
|
# used by both export() & install().
|
|
write_basic_package_version_file("${Ceres_BINARY_DIR}/CeresConfigVersion.cmake"
|
|
VERSION ${CERES_VERSION}
|
|
COMPATIBILITY SameMajorVersion)
|
|
|
|
# Generate one package config for build-tree use and installation.
|
|
configure_package_config_file(
|
|
"${Ceres_SOURCE_DIR}/cmake/CeresConfig.cmake.in"
|
|
"${Ceres_BINARY_DIR}/CeresConfig.cmake"
|
|
INSTALL_DESTINATION "${RELATIVE_CMAKECONFIG_INSTALL_DIR}"
|
|
NO_SET_AND_CHECK_MACRO)
|
|
|
|
# Install method #1: Put Ceres in CMAKE_INSTALL_PREFIX: /usr/local or equivalent.
|
|
|
|
# This "exports" for installation all targets which have been put into the
|
|
# export set "CeresExport". This generates a CeresTargets.cmake file which,
|
|
# when read in by a client project as part of find_package(Ceres) creates
|
|
# imported library targets for Ceres (with dependency relations) which can be
|
|
# used in target_link_libraries() calls in the client project to use Ceres.
|
|
#
|
|
install(EXPORT CeresExport
|
|
NAMESPACE Ceres::
|
|
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR} FILE CeresTargets.cmake)
|
|
|
|
# Install the configuration files into the same directory as the autogenerated
|
|
# CeresTargets.cmake file. We include the find_package() scripts for libraries
|
|
# whose headers are included in the public API of Ceres and should thus be
|
|
# present in CERES_INCLUDE_DIRS.
|
|
install(FILES "${Ceres_BINARY_DIR}/CeresConfig.cmake"
|
|
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
|
|
install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake"
|
|
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
|
|
|
|
if (WITH_UNINSTALL_TARGET)
|
|
# Create an uninstall target to remove all installed files.
|
|
configure_file("${Ceres_SOURCE_DIR}/cmake/uninstall.cmake.in"
|
|
"${Ceres_BINARY_DIR}/cmake/uninstall.cmake"
|
|
@ONLY)
|
|
add_custom_target(uninstall
|
|
COMMAND ${CMAKE_COMMAND} -P ${Ceres_BINARY_DIR}/cmake/uninstall.cmake)
|
|
endif()
|
|
|
|
# Install method #2: Export the Ceres build directory.
|
|
#
|
|
# The package files are always generated in the build tree. CMake's
|
|
# CMAKE_EXPORT_PACKAGE_REGISTRY variable controls whether export(PACKAGE)
|
|
# registers the package in the user package registry.
|
|
set (Ceres_EXPORT_TARGETS ceres)
|
|
|
|
if (TARGET ceres_cuda_kernels)
|
|
# The target ceres depends on ceres_cuda_kernels requiring the latter to be
|
|
# exported as part of the same export set.
|
|
list (APPEND Ceres_EXPORT_TARGETS ceres_cuda_kernels)
|
|
endif (TARGET ceres_cuda_kernels)
|
|
|
|
export(TARGETS ${Ceres_EXPORT_TARGETS}
|
|
NAMESPACE Ceres::
|
|
FILE ${Ceres_BINARY_DIR}/CeresTargets.cmake)
|
|
export(PACKAGE ${CMAKE_PROJECT_NAME})
|
|
|
|
unset (Ceres_EXPORT_TARGETS)
|
|
|
|
add_feature_info("SuiteSparse solvers" _Ceres_FEATURE_SUITESPARSE
|
|
"Sparse solvers from SuiteSparse")
|
|
add_feature_info("CUDA solvers" _Ceres_FEATURE_CUDA
|
|
"CUDA-accelerated linear solvers")
|
|
add_feature_info("cuDSS solver" _Ceres_FEATURE_CUDSS
|
|
"Use the cuDSS sparse linear solver when available")
|
|
add_feature_info("Accelerate sparse solvers" _Ceres_FEATURE_ACCELERATE
|
|
"Sparse solvers from Apple's Accelerate framework")
|
|
add_feature_info("Eigen sparse solvers" _Ceres_FEATURE_EIGEN_SPARSE
|
|
"Sparse linear solvers using Eigen")
|
|
add_feature_info("Eigen METIS ordering" _Ceres_FEATURE_EIGEN_METIS
|
|
"METIS ordering for Eigen sparse solvers")
|
|
add_feature_info("CHOLMOD partitioning" _Ceres_FEATURE_CHOLMOD_PARTITION
|
|
"CHOLMOD graph partitioning")
|
|
add_feature_info("CHOLMOD single precision" WITH_CHOLMOD_FLOAT
|
|
"Single-precision CHOLMOD factorization")
|
|
add_feature_info("Use LAPACK" _Ceres_FEATURE_LAPACK
|
|
"Use LAPACK directly for linear algebra operations")
|
|
add_feature_info("Custom BLAS" WITH_CUSTOM_BLAS
|
|
"Use Ceres hand-written BLAS routines")
|
|
add_feature_info("Schur specializations" WITH_SCHUR_SPECIALIZATIONS
|
|
"Fixed-size Schur solver specializations")
|
|
add_feature_info("Shared library" BUILD_SHARED_LIBS
|
|
"Build Ceres as a shared library instead of a static library")
|
|
add_feature_info("Documentation" _Ceres_FEATURE_DOCUMENTATION
|
|
"Build the Ceres HTML documentation with Sphinx")
|
|
add_feature_info("Examples" BUILD_EXAMPLES "Build Ceres example programs")
|
|
add_feature_info("Benchmarks" _Ceres_FEATURE_BENCHMARKS
|
|
"Build Ceres microbenchmark programs")
|
|
add_feature_info("Tests" BUILD_TESTING "Build Ceres unit and integration tests")
|
|
|
|
function(ceres_dependency_description OUTPUT DESCRIPTION VERSION)
|
|
if (VERSION)
|
|
set(DESCRIPTION "${DESCRIPTION} (version ${VERSION})")
|
|
endif()
|
|
set(${OUTPUT} "${DESCRIPTION}" PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
set(CERES_CUDA_VERSION "${CUDA_VERSION}")
|
|
if (CUDAToolkit_VERSION)
|
|
set(CERES_CUDA_VERSION "${CUDAToolkit_VERSION}")
|
|
endif()
|
|
|
|
ceres_dependency_description(CERES_ABSL_DESCRIPTION
|
|
"C++ common libraries from Google" "${absl_VERSION}")
|
|
ceres_dependency_description(CERES_BENCHMARK_DESCRIPTION
|
|
"A microbenchmark support library" "${benchmark_VERSION}")
|
|
ceres_dependency_description(CERES_CUDA_DESCRIPTION
|
|
"NVIDIA CUDA toolkit" "${CERES_CUDA_VERSION}")
|
|
ceres_dependency_description(CERES_CUDSS_DESCRIPTION
|
|
"NVIDIA CUDA sparse solver library" "${cudss_VERSION}")
|
|
ceres_dependency_description(CERES_EIGEN3_DESCRIPTION
|
|
"C++ template library for linear algebra" "${Eigen3_VERSION}")
|
|
ceres_dependency_description(CERES_GTEST_DESCRIPTION
|
|
"Google's C++ testing framework" "${GOOGLETEST_VERSION}")
|
|
ceres_dependency_description(CERES_METIS_DESCRIPTION
|
|
"Serial graph partitioning and fill-reducing matrix ordering"
|
|
"${METIS_VERSION}")
|
|
ceres_dependency_description(CERES_PYTHON_DESCRIPTION
|
|
"Python interpreter" "${Python_VERSION}")
|
|
ceres_dependency_description(CERES_SPHINX_DESCRIPTION
|
|
"Documentation generator" "${Sphinx_VERSION}")
|
|
ceres_dependency_description(CERES_SUITESPARSE_DESCRIPTION
|
|
"A suite of sparse matrix algorithms" "${SuiteSparse_VERSION}")
|
|
ceres_dependency_description(CERES_TBB_DESCRIPTION
|
|
"Threading Building Blocks" "${TBB_VERSION}")
|
|
|
|
set_package_properties(absl PROPERTIES
|
|
DESCRIPTION "${CERES_ABSL_DESCRIPTION}"
|
|
URL "https://abseil.io")
|
|
set_package_properties(AccelerateSparse PROPERTIES
|
|
DESCRIPTION "Apple's Accelerate framework with sparse linear solvers")
|
|
set_package_properties(benchmark PROPERTIES
|
|
DESCRIPTION "${CERES_BENCHMARK_DESCRIPTION}"
|
|
URL "https://github.com/google/benchmark"
|
|
PURPOSE "Benchmarking of Ceres")
|
|
set_package_properties(BLAS PROPERTIES
|
|
DESCRIPTION "Basic Linear Algebra Subprograms implementation"
|
|
PURPOSE "LAPACK dependency")
|
|
set_package_properties(CUDA PROPERTIES
|
|
DESCRIPTION "${CERES_CUDA_DESCRIPTION}"
|
|
URL "https://developer.nvidia.com/cuda-toolkit"
|
|
PURPOSE "CUDA solver acceleration")
|
|
set_package_properties(CUDAToolkit PROPERTIES
|
|
DESCRIPTION "${CERES_CUDA_DESCRIPTION}"
|
|
URL "https://developer.nvidia.com/cuda-toolkit"
|
|
PURPOSE "CUDA solver acceleration")
|
|
set_package_properties(cudss PROPERTIES
|
|
DESCRIPTION "${CERES_CUDSS_DESCRIPTION}"
|
|
URL "https://developer.nvidia.com/cudss"
|
|
PURPOSE "CUDA sparse solver support")
|
|
set_package_properties(Eigen3 PROPERTIES
|
|
DESCRIPTION "${CERES_EIGEN3_DESCRIPTION}"
|
|
TYPE REQUIRED
|
|
URL "https://eigen.tuxfamily.org")
|
|
set_package_properties(GTest PROPERTIES
|
|
DESCRIPTION "${CERES_GTEST_DESCRIPTION}"
|
|
URL "https://github.com/google/googletest"
|
|
PURPOSE "Ceres unit tests")
|
|
set_package_properties(LAPACK PROPERTIES
|
|
DESCRIPTION "Linear Algebra PACKage implementation"
|
|
TYPE RECOMMENDED)
|
|
set_package_properties(METIS PROPERTIES
|
|
DESCRIPTION "${CERES_METIS_DESCRIPTION}"
|
|
TYPE RECOMMENDED)
|
|
set_package_properties(Python PROPERTIES
|
|
DESCRIPTION "${CERES_PYTHON_DESCRIPTION}"
|
|
URL "https://www.python.org"
|
|
PURPOSE "Sphinx documentation generation")
|
|
set_package_properties(Sphinx PROPERTIES
|
|
DESCRIPTION "${CERES_SPHINX_DESCRIPTION}"
|
|
URL "https://www.sphinx-doc.org"
|
|
PURPOSE "Building the Ceres documentation")
|
|
set_package_properties(SuiteSparse PROPERTIES
|
|
DESCRIPTION "${CERES_SUITESPARSE_DESCRIPTION}"
|
|
TYPE RECOMMENDED
|
|
URL "https://github.com/DrTimothyAldenDavis/SuiteSparse")
|
|
set_package_properties(TBB PROPERTIES
|
|
DESCRIPTION "${CERES_TBB_DESCRIPTION}"
|
|
PURPOSE "SuiteSparseQR dependency")
|
|
set_package_properties(Threads PROPERTIES
|
|
DESCRIPTION "Native platform threading support"
|
|
PURPOSE "Multithreading support")
|
|
|
|
foreach(CERES_PACKAGE_PROPERTY IN ITEMS PACKAGES_FOUND PACKAGES_NOT_FOUND)
|
|
# Keep package summary output unique and alphabetically ordered.
|
|
get_property(CERES_PACKAGE_NAMES GLOBAL PROPERTY ${CERES_PACKAGE_PROPERTY})
|
|
list(REMOVE_DUPLICATES CERES_PACKAGE_NAMES)
|
|
list(SORT CERES_PACKAGE_NAMES COMPARE STRING CASE INSENSITIVE)
|
|
set_property(GLOBAL PROPERTY ${CERES_PACKAGE_PROPERTY} "${CERES_PACKAGE_NAMES}")
|
|
endforeach()
|
|
|
|
feature_summary(WHAT
|
|
REQUIRED_PACKAGES_FOUND
|
|
RECOMMENDED_PACKAGES_FOUND
|
|
OPTIONAL_PACKAGES_FOUND
|
|
REQUIRED_PACKAGES_NOT_FOUND
|
|
RECOMMENDED_PACKAGES_NOT_FOUND
|
|
OPTIONAL_PACKAGES_NOT_FOUND
|
|
ENABLED_FEATURES
|
|
DISABLED_FEATURES
|
|
DESCRIPTION "Ceres ${CERES_VERSION} configuration summary")
|