mirror of https://github.com/microsoft/vcpkg.git
[ceres] fix broken SuiteSparse support, add METIS (#43912)
This commit is contained in:
parent
10ec64caff
commit
ec9c894f01
|
|
@ -0,0 +1,56 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -211,7 +211,7 @@
|
||||
# elsewhere, emulate the effects of FindCUDAToolkit locally in terms of the
|
||||
# expected CMake imported targets and defined variables. This can be removed
|
||||
# from as soon as the min CMake version is >= 3.17.
|
||||
- find_package(CUDA QUIET)
|
||||
+ find_package(CUDA REQUIRED)
|
||||
if (CUDA_FOUND)
|
||||
message("-- Found CUDA version ${CUDA_VERSION} installed in: "
|
||||
"${CUDA_TOOLKIT_ROOT_DIR} via legacy (< 3.17) CMake module. "
|
||||
@@ -240,7 +240,7 @@
|
||||
update_cache_variable(USE_CUDA OFF)
|
||||
endif (CUDA_FOUND)
|
||||
else (CMAKE_VERSION VERSION_LESS 3.17)
|
||||
- find_package(CUDAToolkit QUIET)
|
||||
+ find_package(CUDAToolkit REQUIRED)
|
||||
if (CUDAToolkit_FOUND)
|
||||
message("-- Found CUDA version ${CUDAToolkit_VERSION} installed in: "
|
||||
"${CUDAToolkit_TARGET_DIR}")
|
||||
@@ -270,7 +270,7 @@
|
||||
endif (NOT USE_CUDA)
|
||||
|
||||
if (LAPACK)
|
||||
- find_package(LAPACK QUIET)
|
||||
+ find_package(LAPACK REQUIRED)
|
||||
if (LAPACK_FOUND)
|
||||
message("-- Found LAPACK library: ${LAPACK_LIBRARIES}")
|
||||
else (LAPACK_FOUND)
|
||||
@@ -323,7 +323,7 @@
|
||||
endif (NOT SuiteSparse_Partition_FOUND)
|
||||
|
||||
if (EIGENMETIS)
|
||||
- find_package (METIS)
|
||||
+ find_package (METIS REQUIRED)
|
||||
if (METIS_FOUND)
|
||||
# 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
|
||||
@@ -346,7 +346,7 @@
|
||||
endif (EIGENMETIS)
|
||||
|
||||
if (ACCELERATESPARSE)
|
||||
- find_package(AccelerateSparse)
|
||||
+ find_package(AccelerateSparse REQUIRED)
|
||||
if (AccelerateSparse_FOUND)
|
||||
message("-- Found Apple's Accelerate framework with sparse solvers, "
|
||||
"building with Accelerate sparse support.")
|
||||
@@ -395,7 +395,7 @@
|
||||
# GFlags.
|
||||
if (GFLAGS)
|
||||
# Don't search with REQUIRED as we can continue without gflags.
|
||||
- find_package(gflags 2.2.0)
|
||||
+ find_package(gflags 2.2.0 REQUIRED)
|
||||
if (gflags_FOUND)
|
||||
if (TARGET gflags)
|
||||
message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}")
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -292,8 +292,9 @@
|
||||
# built with SuiteSparse support.
|
||||
|
||||
# Check for SuiteSparse and dependencies.
|
||||
- find_package(SuiteSparse 4.5.6 COMPONENTS CHOLMOD SPQR
|
||||
- OPTIONAL_COMPONENTS Partition)
|
||||
+ find_package(CHOLMOD REQUIRED)
|
||||
+ find_package(SPQR REQUIRED)
|
||||
+ set(SuiteSparse_FOUND 1)
|
||||
if (SuiteSparse_FOUND)
|
||||
set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
|
||||
# By default, if all of SuiteSparse's dependencies are found, Ceres is
|
||||
@@ -301,7 +302,7 @@
|
||||
message("-- Found SuiteSparse ${SuiteSparse_VERSION}, "
|
||||
"building with SuiteSparse.")
|
||||
|
||||
- if (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
|
||||
+ if (0)
|
||||
install(FILES ${Ceres_SOURCE_DIR}/cmake/FindSuiteSparse.cmake
|
||||
${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake
|
||||
DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
|
||||
--- a/internal/ceres/CMakeLists.txt
|
||||
+++ b/internal/ceres/CMakeLists.txt
|
||||
@@ -91,9 +91,10 @@
|
||||
|
||||
if (SUITESPARSE AND SuiteSparse_FOUND)
|
||||
# Define version information for use in Solver::FullReport.
|
||||
- add_definitions(-DCERES_SUITESPARSE_VERSION="${SuiteSparse_VERSION}")
|
||||
- list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::CHOLMOD
|
||||
- SuiteSparse::SPQR)
|
||||
+ add_definitions(-DCERES_SUITESPARSE_VERSION="${SUITESPARSE_CONFIG_VERSION}")
|
||||
+ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES
|
||||
+ $<IF:$<TARGET_EXISTS:SuiteSparse::CHOLMOD>,SuiteSparse::CHOLMOD,SuiteSparse::CHOLMOD_static>
|
||||
+ $<IF:$<TARGET_EXISTS:SuiteSparse::SPQR>,SuiteSparse::SPQR,SuiteSparse::SPQR_static>)
|
||||
|
||||
if (SuiteSparse_Partition_FOUND)
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::Partition)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
--- a/internal/ceres/CMakeLists.txt
|
||||
+++ b/internal/ceres/CMakeLists.txt
|
||||
@@ -112,7 +112,7 @@
|
||||
if (SuiteSparse_Partition_FOUND OR EIGENMETIS)
|
||||
# Define version information for use in Solver::FullReport.
|
||||
add_definitions(-DCERES_METIS_VERSION="${METIS_VERSION}")
|
||||
- list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES METIS::METIS)
|
||||
+ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES metis)
|
||||
endif (SuiteSparse_Partition_FOUND OR EIGENMETIS)
|
||||
|
||||
if (ACCELERATESPARSE AND AccelerateSparse_FOUND)
|
||||
|
|
@ -17,13 +17,16 @@ vcpkg_from_github(
|
|||
0002_use_glog_target.patch
|
||||
0003_fix_exported_ceres_config.patch
|
||||
0004_remove_broken_fake_ba_jac.patch
|
||||
0005_find_package_required.patch
|
||||
0006_use_official_suitesparse_config.patch
|
||||
0007_use_metis_config.patch
|
||||
)
|
||||
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindGflags.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindGlog.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindEigen.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindSuiteSparse.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindMETIS.cmake")
|
||||
file(REMOVE "${SOURCE_PATH}/cmake/FindSuiteSparse.cmake")
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
FEATURES
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "ceres",
|
||||
"version": "2.2.0",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": "non-linear optimization package",
|
||||
"homepage": "https://github.com/ceres-solver/ceres-solver",
|
||||
"license": "Apache-2.0",
|
||||
|
|
@ -29,7 +29,10 @@
|
|||
]
|
||||
},
|
||||
"eigensparse": {
|
||||
"description": "Use of Eigen as a sparse linear algebra library in Ceres"
|
||||
"description": "Use of Eigen as a sparse linear algebra library in Ceres",
|
||||
"dependencies": [
|
||||
"metis"
|
||||
]
|
||||
},
|
||||
"lapack": {
|
||||
"description": "Use Lapack in Ceres",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ index a15d19a..7210a61 100644
|
|||
set(METIS_INSTALL FALSE)
|
||||
else()
|
||||
set(METIS_INSTALL TRUE)
|
||||
@@ -34,19 +34,13 @@ include(./conf/gkbuild.cmake)
|
||||
@@ -34,19 +34,8 @@ include(./conf/gkbuild.cmake)
|
||||
#
|
||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${METIS_COPTIONS}")
|
||||
|
||||
|
|
@ -36,12 +36,7 @@ index a15d19a..7210a61 100644
|
|||
add_subdirectory("libmetis")
|
||||
-add_subdirectory("programs")
|
||||
+
|
||||
+install(EXPORT metisTargets FILE "metisTargets.cmake" DESTINATION "share/metis")
|
||||
+file(WRITE "${CMAKE_INSTALL_PREFIX}/share/metis/metisConfig.cmake" [=[
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+find_dependency(GKlib CONFIG)
|
||||
+include("${CMAKE_CURRENT_LIST_DIR}/metisTargets.cmake")
|
||||
+]=])
|
||||
+include(install_config.cmake)
|
||||
diff --git a/conf/gkbuild.cmake b/conf/gkbuild.cmake
|
||||
index 96435e5..ff43f05 100644
|
||||
--- a/conf/gkbuild.cmake
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
install(EXPORT metisTargets
|
||||
FILE metisTargets.cmake
|
||||
DESTINATION share/metis
|
||||
)
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/metisConfig.cmake"
|
||||
"include(CMakeFindDependencyMacro)
|
||||
find_dependency(GKlib CONFIG)
|
||||
include(\"\${CMAKE_CURRENT_LIST_DIR}/metisTargets.cmake\")
|
||||
")
|
||||
|
||||
# Copied from https://github.com/ceres-solver/ceres-solver/blob/2.2.0/cmake/FindMETIS.cmake#L69-L77
|
||||
file(READ "${PROJECT_SOURCE_DIR}/include/metis.h" _METIS_VERSION_CONTENTS)
|
||||
string(REGEX REPLACE ".*#define METIS_VER_MAJOR[ \t]+([0-9]+).*" "\\1"
|
||||
METIS_VERSION_MAJOR "${_METIS_VERSION_CONTENTS}")
|
||||
string(REGEX REPLACE ".*#define METIS_VER_MINOR[ \t]+([0-9]+).*" "\\1"
|
||||
METIS_VERSION_MINOR "${_METIS_VERSION_CONTENTS}")
|
||||
string(REGEX REPLACE ".*#define METIS_VER_SUBMINOR[ \t]+([0-9]+).*" "\\1"
|
||||
METIS_VERSION_PATCH "${_METIS_VERSION_CONTENTS}")
|
||||
set(METIS_VERSION "${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR}.${METIS_VERSION_PATCH}")
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/metisConfigVersion.cmake"
|
||||
VERSION ${METIS_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/metisConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/metisConfigVersion.cmake"
|
||||
DESTINATION "share/metis"
|
||||
)
|
||||
|
|
@ -8,6 +8,8 @@ vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
|
|||
build-fixes.patch
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/install_config.cmake" DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}")
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "metis",
|
||||
"version-date": "2022-07-27",
|
||||
"port-version": 1,
|
||||
"description": "Serial Graph Partitioning and Fill-reducing Matrix Ordering",
|
||||
"homepage": "https://github.com/KarypisLab/METIS",
|
||||
"license": "Apache-2.0",
|
||||
|
|
|
|||
|
|
@ -1598,7 +1598,7 @@
|
|||
},
|
||||
"ceres": {
|
||||
"baseline": "2.2.0",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"cfitsio": {
|
||||
"baseline": "3.49",
|
||||
|
|
@ -6054,7 +6054,7 @@
|
|||
},
|
||||
"metis": {
|
||||
"baseline": "2022-07-27",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"metrohash": {
|
||||
"baseline": "1.1.3",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "e18de40c8d263f3f8d08782939cd3dd6bb5d4a6a",
|
||||
"version": "2.2.0",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "c513d3f02c6a12f193adbd33051058e576d2c3da",
|
||||
"version": "2.2.0",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "a73f3c906ed3cffa805aa33bdbf067f000a7dfe0",
|
||||
"version-date": "2022-07-27",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "1a8b82dc534499155aca4057cb5ee998da7cdbc4",
|
||||
"version-date": "2022-07-27",
|
||||
|
|
|
|||
Loading…
Reference in New Issue