[go: nahoru, domu]

Skip to content

Commit

Permalink
[ceres] update to 2.0.0 (microsoft#14719)
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Facioni authored Dec 1, 2020
1 parent 18c93ab commit 326e8c8
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 209 deletions.
26 changes: 15 additions & 11 deletions ports/ceres/0001_cmakelists_fixes.patch
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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.
14 changes: 7 additions & 7 deletions ports/ceres/0002_use_glog_target.patch
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
98 changes: 34 additions & 64 deletions ports/ceres/0003_fix_exported_ceres_config.patch
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
122 changes: 0 additions & 122 deletions ports/ceres/0004_fix_find_eigen.patch

This file was deleted.

3 changes: 1 addition & 2 deletions ports/ceres/CONTROL
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions ports/ceres/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions ports/theia/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 326e8c8

Please sign in to comment.