[ceres] Added patch to add find_dependency() for suitesparse targets downstream (#11200)

* Added patch to add find_dependency() for suitesparse targets downstream

Should address / close microsoft/vcpkg#7556

* Bumped port version to -7

* Removed patch that uses vcpkg features for suitesparse and added
suitesparse detection logic in CeresConfig.cmake.in

* Changed configure options to detect features using `vcpkg_check_features()`

* Passed `${FEATURE_OPTIONS}` to `vcpkg_configure_cmake()`
This commit is contained in:
Don Venable 2020-05-11 18:45:42 -04:00 committed by GitHub
parent 10bb90bbdf
commit 2601736b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 34 deletions

View File

@ -1,8 +1,8 @@
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in
index d0380de..bf4c2eb 100644
index d0380de..55760a8 100644
--- a/cmake/CeresConfig.cmake.in
+++ b/cmake/CeresConfig.cmake.in
@@ -237,85 +237,8 @@ endif (EIGEN_FOUND)
@@ -237,85 +237,13 @@ endif (EIGEN_FOUND)
list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
# Glog.
@ -40,7 +40,9 @@ index d0380de..bf4c2eb 100644
- get_filename_component(CERES_BUILD_GLOG_LIBRARY_DIR @GLOG_LIBRARY@ PATH)
- list(APPEND GLOG_LIBRARY_DIR_HINTS ${CERES_BUILD_GLOG_LIBRARY_DIR})
- 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)
@ -85,8 +87,10 @@ index d0380de..bf4c2eb 100644
- list(APPEND CERES_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR_HINTS})
- endif()
-endif (CERES_USES_MINIGLOG)
+include (CMakeFindDependencyMacro)
+find_dependency (glog NO_MODULE)
+#SuiteSparse
+if (@SUITESPARSE@)
+ find_dependency(suitesparse CONFIG REQUIRED)
+endif()
# Import exported Ceres targets, if they have not already been imported.
if (NOT TARGET ceres AND NOT Ceres_BINARY_DIR)

View File

@ -1,5 +1,5 @@
Source: ceres
Version: 1.14.0-6
Version: 1.14.0-7
Build-Depends: glog, eigen3
Homepage: https://github.com/ceres-solver/ceres-solver
Description: non-linear optimization package

View File

@ -29,43 +29,23 @@ file(REMOVE ${SOURCE_PATH}/cmake/FindGlog.cmake)
file(REMOVE ${SOURCE_PATH}/cmake/FindSuiteSparse.cmake)
#file(REMOVE ${SOURCE_PATH}/cmake/FindTBB.cmake)
set(SUITESPARSE OFF)
if("suitesparse" IN_LIST FEATURES)
set(SUITESPARSE ON)
endif()
set(CXSPARSE OFF)
if("cxsparse" IN_LIST FEATURES)
set(CXSPARSE ON)
endif()
set(LAPACK OFF)
if("lapack" IN_LIST FEATURES)
set(LAPACK ON)
endif()
set(EIGENSPARSE OFF)
if("eigensparse" IN_LIST FEATURES)
set(EIGENSPARSE ON)
endif()
set(GFLAGS OFF)
if("tools" IN_LIST FEATURES)
set(GFLAGS ON)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"suitesparse" SUITESPARSE
"cxsparse" CXSPARSE
"lapack" LAPACK
"eigensparse" EIGENSPARSE
"tools" GFLAGS
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DEXPORT_BUILD_DIR=ON
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
-DGFLAGS=${GFLAGS}
-DCXSPARSE=${CXSPARSE}
-DEIGENSPARSE=${EIGENSPARSE}
-DLAPACK=${LAPACK}
-DSUITESPARSE=${SUITESPARSE}
-DMSVC_USE_STATIC_CRT=${MSVC_USE_STATIC_CRT_VALUE}
-DLIB_SUFFIX=${LIB_SUFFIX}
)