Skip to content

Commit

Permalink
Merge pull request #2 from NeroBurner/hunter_1.12.0
Browse files Browse the repository at this point in the history
Hunter 1.12.0
  • Loading branch information
ruslo authored Jan 16, 2017
2 parents 029799d + 268aa0f commit 5b186cf
Show file tree
Hide file tree
Showing 4 changed files with 579 additions and 32 deletions.
37 changes: 19 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ cmake_minimum_required(VERSION 2.8.0)
cmake_policy(VERSION 2.8)

cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0053 NEW)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()

include(cmake/HunterGate.cmake)
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.17.12.tar.gz"
SHA1 "74cfa490ef0d3ff8916523bbf5add53049aad7be"
)

project(Ceres C CXX)

# Make CMake aware of the cmake folder for local FindXXX scripts,
Expand Down Expand Up @@ -194,15 +201,16 @@ endif (IOS)
unset(CERES_COMPILE_OPTIONS)

# Eigen.
find_package(Eigen REQUIRED)
if (EIGEN_FOUND)
if (EIGEN_VERSION VERSION_LESS 3.1.0)
hunter_add_package(Eigen)
find_package(Eigen3 REQUIRED)
if (EIGEN3_FOUND)
if (EIGEN3_VERSION_STRING VERSION_LESS 3.1.0)
message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.1.0 in order "
"that Eigen/SparseCore be available, detected version of Eigen is: "
"${EIGEN_VERSION}")
endif (EIGEN_VERSION VERSION_LESS 3.1.0)
"${EIGEN3_VERSION_STRING}")
endif (EIGEN3_VERSION VERSION_LESS 3.1.0)

message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}")
message("-- Found Eigen version ${EIGEN_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}")
# Ensure that only MPL2 licensed code is part of the default build.
message("")
message(" ===============================================================")
Expand All @@ -214,13 +222,13 @@ if (EIGEN_FOUND)
message(" Ceres Solver as the Simplicial Cholesky factorization in Eigen")
message(" is licensed under the LGPL. ")

if (EIGEN_VERSION VERSION_LESS 3.2.2)
if (EIGEN3_VERSION VERSION_LESS 3.2.2)
message(" WARNING:")
message("")
message(" Your version of Eigen is older than version 3.2.2.")
message(" The performance of SPARSE_NORMAL_CHOLESKY and SPARSE_SCHUR")
message(" linear solvers will suffer. ")
endif (EIGEN_VERSION VERSION_LESS 3.2.2)
endif (EIGEN3_VERSION VERSION_LESS 3.2.2)

else (EIGENSPARSE)
message(" Disabling the use of Eigen as a sparse linear algebra library.")
Expand All @@ -230,7 +238,7 @@ if (EIGEN_FOUND)
endif (EIGENSPARSE)
message(" ===============================================================")
message("")
endif (EIGEN_FOUND)
endif (EIGEN3_FOUND)

# LAPACK (& BLAS).
if (LAPACK)
Expand Down Expand Up @@ -380,6 +388,7 @@ if (MINIGLOG)
else (MINIGLOG)
# Don't search with REQUIRED so that configuration continues if not found and
# we can output an error messages explaining MINIGLOG option.
hunter_add_package(glog)
find_package(Glog)
if (NOT GLOG_FOUND)
message(FATAL_ERROR "Can't find Google Log (glog). Please set either: "
Expand Down Expand Up @@ -500,11 +509,6 @@ if (CXX11)
endif()
endif(CXX11)

include_directories(
include
internal
internal/ceres
${GLOG_INCLUDE_DIRS})
# Eigen SparseQR generates various compiler warnings related to unused and
# uninitialised local variables. To avoid having to individually suppress these
# warnings around the #include statments for Eigen headers across all GCC/Clang
Expand All @@ -514,7 +518,7 @@ include_directories(
# Note that this is *not* propagated to clients, ie CERES_INCLUDE_DIRS
# used by clients after find_package(Ceres) does not identify Eigen as
# as system headers.
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
#include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS})

if (SUITESPARSE)
include_directories(${SUITESPARSE_INCLUDE_DIRS})
Expand Down Expand Up @@ -840,9 +844,6 @@ install(FILES "${CMAKE_BINARY_DIR}/CeresConfig-install.cmake"
RENAME CeresConfig.cmake
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
install(FILES "${CMAKE_BINARY_DIR}/CeresConfigVersion.cmake"
"${CMAKE_SOURCE_DIR}/cmake/FindEigen.cmake"
"${CMAKE_SOURCE_DIR}/cmake/FindGlog.cmake"
"${CMAKE_SOURCE_DIR}/cmake/FindGflags.cmake"
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})

# Create an uninstall target to remove all installed files.
Expand Down
28 changes: 14 additions & 14 deletions cmake/CeresConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ set(CERES_VERSION @CERES_VERSION@ )

# Eigen.
# Flag set during configuration and build of Ceres.
set(CERES_EIGEN_VERSION @EIGEN_VERSION@)
set(CERES_EIGEN_VERSION @EIGEN3_VERSION_STRING@)
# Append the locations of Eigen when Ceres was built to the search path hints.
list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN_INCLUDE_DIR@)
list(APPEND EIGEN3_INCLUDE_DIR_HINTS @EIGEN3_INCLUDE_DIR@)
# Search quietly to control the timing of the error message if not found. The
# search should be for an exact match, but for usability reasons do a soft
# match and reject with an explanation below.
find_package(Eigen ${CERES_EIGEN_VERSION} QUIET)
if (EIGEN_FOUND)
if (NOT EIGEN_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
find_package(Eigen3 ${CERES_EIGEN_VERSION} QUIET)
if (EIGEN3_FOUND)
if (NOT EIGEN3_VERSION_STRING VERSION_EQUAL CERES_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
# specified version. However, only version = is supported. Improve
# usability by explaining why we don't accept non-exact version matching.
Expand All @@ -222,13 +222,13 @@ if (EIGEN_FOUND)
"for more details")
endif ()
message(STATUS "Found required Ceres dependency: "
"Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN_INCLUDE_DIRS}")
else (EIGEN_FOUND)
"Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIRS}")
else (EIGEN3_FOUND)
ceres_report_not_found("Missing required Ceres "
"dependency: Eigen version ${CERES_EIGEN_VERSION}, please set "
"EIGEN_INCLUDE_DIR.")
endif (EIGEN_FOUND)
list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
"EIGEN3_INCLUDE_DIR.")
endif (EIGEN3_FOUND)
list(APPEND CERES_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS})

# Glog.
# Flag set during configuration and build of Ceres.
Expand Down Expand Up @@ -260,14 +260,14 @@ else (CERES_USES_MINIGLOG)
endif()

# Search quietly s/t we control the timing of the error message if not found.
find_package(Glog QUIET)
if (GLOG_FOUND)
find_package(glog QUIET)
if (glog_FOUND)
message(STATUS "Found required Ceres dependency: glog")
else (GLOG_FOUND)
else (glog_FOUND)
ceres_report_not_found("Missing required Ceres "
"dependency: glog. Searched using GLOG_INCLUDE_DIR_HINTS: "
"${GLOG_INCLUDE_DIR_HINTS} and glog_DIR: ${glog_DIR}.")
endif (GLOG_FOUND)
endif (glog_FOUND)
list(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS})

# gflags is only a public dependency of Ceres via glog, thus is not required
Expand Down
Loading

0 comments on commit 5b186cf

Please sign in to comment.