From 326e8c815666cacd2bd67bd79af6e74011708107 Mon Sep 17 00:00:00 2001 From: Francisco Facioni Date: Tue, 1 Dec 2020 23:13:35 +0100 Subject: [PATCH] [ceres] update to 2.0.0 (#14719) --- ports/ceres/0001_cmakelists_fixes.patch | 26 ++-- ports/ceres/0002_use_glog_target.patch | 14 +- .../0003_fix_exported_ceres_config.patch | 98 +++++--------- ports/ceres/0004_fix_find_eigen.patch | 122 ------------------ ports/ceres/CONTROL | 3 +- ports/ceres/portfile.cmake | 5 +- ports/theia/portfile.cmake | 3 + 7 files changed, 62 insertions(+), 209 deletions(-) delete mode 100644 ports/ceres/0004_fix_find_eigen.patch diff --git a/ports/ceres/0001_cmakelists_fixes.patch b/ports/ceres/0001_cmakelists_fixes.patch index 87a3785d5f..bb59427237 100644 --- a/ports/ceres/0001_cmakelists_fixes.patch +++ b/ports/ceres/0001_cmakelists_fixes.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 02c72b5..62d8c59 100644 +index 33e98b1..f275d68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -374,27 +374,7 @@ if (MINIGLOG) +@@ -426,27 +426,7 @@ if (MINIGLOG) GLOG_LIBRARY) else (MINIGLOG) unset(MINIGLOG_MAX_LOG_LEVEL CACHE) @@ -19,24 +19,28 @@ index 02c72b5..62d8c59 100644 - set(GLOG_GFLAGS_DEPENDENCY_MESSAGE - " Assuming glog was built with gflags support as gflags was found. " - "This will make gflags a public dependency of Ceres.") -- if (NOT GFLAGS_FOUND) +- if (NOT gflags_FOUND) - set(GLOG_GFLAGS_DEPENDENCY_MESSAGE - " Assuming glog was NOT built with gflags support as gflags was " - "not found. If glog was built with gflags, please set the " - "gflags search locations such that it can be found by Ceres. " - "Otherwise, Ceres may fail to link due to missing gflags symbols.") -- endif(NOT GFLAGS_FOUND) +- endif(NOT gflags_FOUND) - message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) + find_package(Glog REQUIRED) endif (MINIGLOG) - + if (NOT SCHUR_SPECIALIZATIONS) -@@ -917,8 +897,5 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" +@@ -760,12 +740,6 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindEigen.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake" -- "${Ceres_SOURCE_DIR}/cmake/FindGflags.cmake" DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) - - # Create an uninstall target to remove all installed files. +-if (GLOG_FOUND AND NOT FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION) +- # Version of glog detected was not built with CMake, install our glog module +- # file to enable detection in CeresConfig. +- install(FILES "${Ceres_SOURCE_DIR}/cmake/FindGlog.cmake" +- DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) +-endif() + + if (PROVIDE_UNINSTALL_TARGET) + # Create an uninstall target to remove all installed files. diff --git a/ports/ceres/0002_use_glog_target.patch b/ports/ceres/0002_use_glog_target.patch index 6ca328a8ec..5405ea53df 100644 --- a/ports/ceres/0002_use_glog_target.patch +++ b/ports/ceres/0002_use_glog_target.patch @@ -1,20 +1,20 @@ diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt -index cc43fec..18b415b 100644 +index 3711222..8646bd0 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt -@@ -152,17 +152,9 @@ else (SCHUR_SPECIALIZATIONS) - endif (SCHUR_SPECIALIZATIONS) - - # Build the list of dependencies for Ceres based on the current configuration. +@@ -174,17 +174,9 @@ endif (SCHUR_SPECIALIZATIONS) + find_package(Threads QUIET) + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES Threads::Threads) + -if (NOT MINIGLOG AND GLOG_FOUND) - list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) -- if (GFLAGS_FOUND) +- if (gflags_FOUND) - # If glog & gflags are both found, we assume that glog was built with - # gflags, as it is awkward to perform a try_compile() to verify this - # when gflags is an imported target (as it is in newer versions). - # As glog #includes gflags/gflags.h in glog/logging.h if compiled with - # gflags, it is thus a public dependency for Ceres in this case. -- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GFLAGS_LIBRARIES}) +- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES gflags) - endif() -endif (NOT MINIGLOG AND GLOG_FOUND) +if (NOT MINIGLOG) diff --git a/ports/ceres/0003_fix_exported_ceres_config.patch b/ports/ceres/0003_fix_exported_ceres_config.patch index 9b02e99633..332ef59528 100644 --- a/ports/ceres/0003_fix_exported_ceres_config.patch +++ b/ports/ceres/0003_fix_exported_ceres_config.patch @@ -1,93 +1,63 @@ diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in -index d0380de..55760a8 100644 +index e5e2976..be1083a 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in -@@ -237,85 +237,13 @@ endif (EIGEN_FOUND) - list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}) +@@ -213,55 +213,13 @@ else (EIGEN3_FOUND) + endif (EIGEN3_FOUND) - # Glog. --# Flag set during configuration and build of Ceres. + # glog (and maybe gflags). +-# +-# Flags set during configuration and build of Ceres. -set(CERES_USES_MINIGLOG @MINIGLOG@) +-set(CERES_GLOG_VERSION @glog_VERSION@) +-set(CERES_GLOG_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION@) +- -set(CERES_USES_GFLAGS @GFLAGS@) +-set(CERES_GFLAGS_VERSION @gflags_VERSION@) +- -if (CERES_USES_MINIGLOG) -- set(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog) -- if (NOT CERES_WAS_INSTALLED) -- # When Ceres was exported from the build tree, the miniglog headers -- # will be in Ceres internal source directory, not in the public headers -- # directory (they are copied with the public headers when installed). -- set(MINIGLOG_INCLUDE_DIR -- ${CERES_EXPORTED_SOURCE_DIR}/internal/ceres/miniglog) -- endif() -- if (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) -- ceres_report_not_found( -- "Failed to find miniglog headers in expected include directory: " -- "${MINIGLOG_INCLUDE_DIR}, but Ceres was compiled with MINIGLOG enabled " -- "(in place of glog).") -- endif (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) -- list(APPEND CERES_INCLUDE_DIRS ${MINIGLOG_INCLUDE_DIR}) - # Output message at standard log level (not the lower STATUS) so that - # the message is output in GUI during configuration to warn user. -- message("-- Found Ceres compiled with miniglog substitute " +- ceres_message("-- Found Ceres compiled with miniglog substitute " - "for glog, beware this will likely cause problems if glog is later linked.") --else (CERES_USES_MINIGLOG) -- # Append the locations of glog when Ceres was built to the search path hints. -- set(GLOG_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION@) -- if (GLOG_WAS_BUILT_WITH_CMAKE) -- set(glog_DIR @glog_DIR@) -- set(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION TRUE) +-else(CERES_USES_MINIGLOG) +- if (CERES_GLOG_WAS_BUILT_WITH_CMAKE) +- find_package(glog ${CERES_GLOG_VERSION} CONFIG QUIET) +- set(GLOG_FOUND ${glog_FOUND}) - else() -- list(APPEND GLOG_INCLUDE_DIR_HINTS @GLOG_INCLUDE_DIR@) -- get_filename_component(CERES_BUILD_GLOG_LIBRARY_DIR @GLOG_LIBRARY@ PATH) +- # Version of glog against which Ceres was built was not built with CMake, +- # use the exported glog find_package() module from Ceres to find it again. +- # Append the locations of glog when Ceres was built to the search path hints. +- list(APPEND GLOG_INCLUDE_DIR_HINTS "@GLOG_INCLUDE_DIR@") +- get_filename_component(CERES_BUILD_GLOG_LIBRARY_DIR "@GLOG_LIBRARY@" PATH) - list(APPEND GLOG_LIBRARY_DIR_HINTS ${CERES_BUILD_GLOG_LIBRARY_DIR}) +- +- # Search quietly s/t we control the timing of the error message if not found. +- find_package(Glog QUIET) - endif() +include (CMakeFindDependencyMacro) +find_dependency (glog NO_MODULE) -- # Search quietly s/t we control the timing of the error message if not found. -- find_package(Glog QUIET) - if (GLOG_FOUND) -- message(STATUS "Found required Ceres dependency: glog") -- 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) -- list(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS}) +- ceres_message(STATUS "Found required Ceres dependency: glog") +- else() +- ceres_report_not_found("Missing required Ceres dependency: glog.") +- endif() - - # gflags is only a public dependency of Ceres via glog, thus is not required - # if Ceres was built with MINIGLOG. - if (CERES_USES_GFLAGS) -- # If gflags was found as an imported CMake target, we need to call -- # find_packge(Gflags) again here, as imported CMake targets are not -- # re-exported. Without this, the 'gflags-shared' target name which is -- # present in CERES_LIBRARIES in this case would not be defined, and so -- # CMake will assume it is a library name (which it is not) and fail to link. -- # -- # Append the locations of gflags when Ceres was built to the search path -- # hints. -- set(GFLAGS_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION@) -- if (GFLAGS_WAS_BUILT_WITH_CMAKE) -- set(gflags_DIR @gflags_DIR@) -- set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE) -- else() -- list(APPEND GFLAGS_INCLUDE_DIR_HINTS @GFLAGS_INCLUDE_DIR@) -- get_filename_component(CERES_BUILD_GFLAGS_LIBRARY_DIR @GFLAGS_LIBRARY@ PATH) -- list(APPEND GFLAGS_LIBRARY_DIR_HINTS ${CERES_BUILD_GFLAGS_LIBRARY_DIR}) -- endif() -- - # Search quietly s/t we control the timing of the error message if not found. -- find_package(Gflags QUIET) -- if (GFLAGS_FOUND) -- message(STATUS "Found required Ceres dependency: gflags") +- find_package(gflags ${CERES_GFLAGS_VERSION} QUIET) +- if (gflags_FOUND AND TARGET gflags) +- ceres_message(STATUS "Found required Ceres dependency: gflags") - else() - ceres_report_not_found("Missing required Ceres " -- "dependency: gflags. Searched using GFLAGS_INCLUDE_DIR_HINTS: " -- "${GFLAGS_INCLUDE_DIR_HINTS} and gflags_DIR: ${gflags_DIR}.") +- "dependency: gflags (not found, or not found as exported CMake target).") - endif() -- list(APPEND CERES_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR_HINTS}) - endif() --endif (CERES_USES_MINIGLOG) -+#SuiteSparse +-endif(CERES_USES_MINIGLOG) ++# SuiteSparse +if (@SUITESPARSE@) + find_dependency(suitesparse CONFIG) +endif() diff --git a/ports/ceres/0004_fix_find_eigen.patch b/ports/ceres/0004_fix_find_eigen.patch deleted file mode 100644 index ad92228c0b..0000000000 --- a/ports/ceres/0004_fix_find_eigen.patch +++ /dev/null @@ -1,122 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7033de0..5235baa 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -209,40 +209,40 @@ endif (IOS) - unset(CERES_COMPILE_OPTIONS) - - # Eigen. --find_package(Eigen REQUIRED) --if (EIGEN_FOUND) -- message("-- Found Eigen version ${EIGEN_VERSION}: ${EIGEN_INCLUDE_DIRS}") -- if (EIGEN_VERSION VERSION_LESS 3.1.0) -+find_package(Eigen3 REQUIRED) -+if (EIGEN3_FOUND) -+ message(STATUS "Found Eigen version ${EIGEN3_VERSION_STRING}: ${EIGEN3_INCLUDE_DIRS}") -+ 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_STRING VERSION_LESS 3.1.0) - - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" AND -- EIGEN_VERSION VERSION_LESS 3.3.4) -+ EIGEN3_VERSION_STRING VERSION_LESS 3.3.4) - # As per issue #289: https://github.com/ceres-solver/ceres-solver/issues/289 - # the bundle_adjustment_test will fail for Eigen < 3.3.4 on aarch64. - message(FATAL_ERROR "-- Ceres requires Eigen version >= 3.3.4 on aarch64. " -- "Detected version of Eigen is: ${EIGEN_VERSION}.") -+ "Detected version of Eigen is: ${EIGEN3_VERSION_STRING}.") - endif() - - if (EIGENSPARSE) -- message("-- Enabling use of Eigen as a sparse linear algebra library.") -+ message(STATUS "Enabling use of Eigen as a sparse linear algebra library.") - list(APPEND CERES_COMPILE_OPTIONS CERES_USE_EIGEN_SPARSE) -- if (EIGEN_VERSION VERSION_LESS 3.2.2) -+ if (EIGEN3_VERSION_STRING VERSION_LESS 3.2.2) - message(" WARNING:") - message("") -- message(" Your version of Eigen (${EIGEN_VERSION}) is older than ") -+ message(" Your version of Eigen (${EIGEN3_VERSION_STRING}) is older than ") - message(" version 3.2.2. The performance of SPARSE_NORMAL_CHOLESKY ") - message(" and SPARSE_SCHUR linear solvers will suffer.") -- endif (EIGEN_VERSION VERSION_LESS 3.2.2) -+ endif (EIGEN3_VERSION_STRING VERSION_LESS 3.2.2) - else (EIGENSPARSE) - message("-- Disabling use of Eigen as a sparse linear algebra library.") - message(" This does not affect the covariance estimation algorithm ") - message(" which can still use the EIGEN_SPARSE_QR algorithm.") - add_definitions(-DEIGEN_MPL2_ONLY) - endif (EIGENSPARSE) --endif (EIGEN_FOUND) -+endif (EIGEN3_FOUND) - - if (LAPACK) - find_package(LAPACK QUIET) -@@ -562,7 +562,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(${EIGEN3_INCLUDE_DIRS}) - - if (SUITESPARSE) - include_directories(${SUITESPARSE_INCLUDE_DIRS}) -diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in -index c4ed71f..b3d6a17 100644 ---- a/cmake/CeresConfig.cmake.in -+++ b/cmake/CeresConfig.cmake.in -@@ -202,39 +202,39 @@ 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@) - set(EIGEN_WAS_BUILT_WITH_CMAKE @FOUND_INSTALLED_EIGEN_CMAKE_CONFIGURATION@) - # Append the locations of Eigen when Ceres was built to the search path hints. - if (EIGEN_WAS_BUILT_WITH_CMAKE) - set(Eigen3_DIR @Eigen3_DIR@) - set(EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION TRUE) - else() -- list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN_INCLUDE_DIR@) -+ list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN3_INCLUDE_DIR@) - endif() - # 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. - ceres_report_not_found("Found Eigen dependency, but the version of Eigen " -- "found (${EIGEN_VERSION}) does not exactly match the version of Eigen " -+ "found (${EIGEN3_VERSION_STRING}) does not exactly match the version of Eigen " - "Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle " - "bugs by triggering violations of the One Definition Rule. See the " - "Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule " - "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. - include (CMakeFindDependencyMacro) diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL index 5fb8186add..2ad6f31be3 100644 --- a/ports/ceres/CONTROL +++ b/ports/ceres/CONTROL @@ -1,6 +1,5 @@ Source: ceres -Version: 1.14.0 -Port-Version: 10 +Version: 2.0.0 Build-Depends: glog, eigen3 Homepage: https://github.com/ceres-solver/ceres-solver Description: non-linear optimization package diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index e7c455c562..c1dca74a95 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -9,14 +9,13 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ceres-solver/ceres-solver - REF 1.14.0 - SHA512 6dddddf5bd5834332a69add468578ad527e4d94fe85c9751ddf5fe9ad11a34918bdd9c994c49dd6ffc398333d0ac9752ac89aaef1293e2fe0a55524e303d415d + REF 2.0.0 + SHA512 6379666ef57af4ea85026644fa21365ce18fbaa12d50bd452bcdae0743a7b013effdd42c961e90c31815991bf315bd6904553dcc1a382ff5ed8c7abe9edf9a6c HEAD_REF master PATCHES 0001_cmakelists_fixes.patch 0002_use_glog_target.patch 0003_fix_exported_ceres_config.patch - 0004_fix_find_eigen.patch ) file(REMOVE ${SOURCE_PATH}/cmake/FindCXSparse.cmake) diff --git a/ports/theia/portfile.cmake b/ports/theia/portfile.cmake index 77b4c11c3d..e5e7ffcab3 100644 --- a/ports/theia/portfile.cmake +++ b/ports/theia/portfile.cmake @@ -19,6 +19,9 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS + -DCMAKE_CXX_STANDARD=14 + -DCMAKE_CXX_EXTENSIONS=OFF + -DCMAKE_CXX_STANDARD_REQUIRED=ON -DBUILD_TESTING=OFF -DTHEIA_USE_EXTERNAL_CEREAL=ON -DTHEIA_USE_EXTERNAL_FLANN=ON