Skip to content

Commit

Permalink
[SuiteSparse] Update and split into sub-packages (v2) (microsoft#41929)
Browse files Browse the repository at this point in the history
Co-authored-by: Monica <[email protected]>
Co-authored-by: Monica <[email protected]>
  • Loading branch information
3 people authored Jan 27, 2025
1 parent f3a67b0 commit ab42fb3
Show file tree
Hide file tree
Showing 77 changed files with 1,891 additions and 504 deletions.
60 changes: 2 additions & 58 deletions ports/ceres/0001_cmakelists_fixes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e49c19e..f8c61d92 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -292,27 +292,28 @@ if (SUITESPARSE)
# built with SuiteSparse support.

# Check for SuiteSparse and dependencies.
- find_package(SuiteSparse 4.5.6 COMPONENTS CHOLMOD SPQR
- OPTIONAL_COMPONENTS Partition)
- if (SuiteSparse_FOUND)
- set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
+ find_package(SuiteSparse REQUIRED CONFIG)
+ if (SUITESPARSE_FOUND)
+ set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION} CONFIG)")
# By default, if all of SuiteSparse's dependencies are found, Ceres is
# built with SuiteSparse support.
message("-- Found SuiteSparse ${SuiteSparse_VERSION}, "
"building with SuiteSparse.")
-
- if (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
- install(FILES ${Ceres_SOURCE_DIR}/cmake/FindSuiteSparse.cmake
- ${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake
- DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR})
- endif (SuiteSparse_NO_CMAKE OR NOT SuiteSparse_DIR)
- else (SuiteSparse_FOUND)
+ add_library(SuiteSparse::CONFIG ALIAS SuiteSparse::suitesparseconfig)
+ add_library(SuiteSparse::AMD ALIAS SuiteSparse::amd)
+ add_library(SuiteSparse::CAMD ALIAS SuiteSparse::camd)
+ add_library(SuiteSparse::CCOLAMD ALIAS SuiteSparse::ccolamd)
+ add_library(SuiteSparse::COLAMD ALIAS SuiteSparse::colamd)
+ add_library(SuiteSparse::CHOLMOD ALIAS SuiteSparse::cholmod)
+ add_library(SuiteSparse::SPQR ALIAS SuiteSparse::spqr)
+ add_library(METIS::METIS ALIAS metis)
+ else (SUITESPARSE_FOUND)
# Disable use of SuiteSparse if it cannot be found and continue.
message("-- Did not find all SuiteSparse dependencies, disabling "
"SuiteSparse support.")
update_cache_variable(SUITESPARSE OFF)
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_SUITESPARSE)
- endif (SuiteSparse_FOUND)
+ endif (SUITESPARSE_FOUND)
else (SUITESPARSE)
message("-- Building without SuiteSparse.")
list(APPEND CERES_COMPILE_OPTIONS CERES_NO_SUITESPARSE)
@@ -395,9 +396,12 @@ endif()
# GFlags.
if (GFLAGS)
# Don't search with REQUIRED as we can continue without gflags.
- find_package(gflags 2.2.0)
+ find_package(gflags CONFIG REQUIRED)
if (gflags_FOUND)
- if (TARGET gflags)
+ if (TARGET gflags::gflags)
+ if(NOT TARGET gflags)
+ add_library(gflags ALIAS gflags::gflags)
+ endif()
message("-- Found Google Flags (gflags) version ${gflags_VERSION}: ${gflags_DIR}")
else()
message("-- Detected version of gflags: ${gflags_VERSION} does not define "
@@ -430,28 +434,7 @@ if (MINIGLOG)
@@ -430,28 +430,7 @@ if (MINIGLOG)
mark_as_advanced(FORCE GLOG_INCLUDE_DIR
GLOG_LIBRARY)
else (MINIGLOG)
Expand Down Expand Up @@ -88,7 +32,7 @@ index 8e49c19e..f8c61d92 100644
endif (MINIGLOG)

if (NOT SCHUR_SPECIALIZATIONS)
@@ -466,7 +449,7 @@ endif (NOT CUSTOM_BLAS)
@@ -466,7 +445,7 @@ endif (NOT CUSTOM_BLAS)

if (BUILD_BENCHMARKS)
# Version 1.3 was first to provide import targets
Expand Down
19 changes: 15 additions & 4 deletions ports/ceres/0003_fix_exported_ceres_config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@ diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in
index ceb7e269..5dee7e3c 100644
--- a/cmake/CeresConfig.cmake.in
+++ b/cmake/CeresConfig.cmake.in
@@ -195,7 +195,7 @@ set(CERES_EIGEN_VERSION @Eigen3_VERSION@)
@@ -178,7 +178,10 @@
include(CMakeFindDependencyMacro)
# Optional dependencies
@METIS_DEPENDENCY@
-@SuiteSparse_DEPENDENCY@
+if (@SUITESPARSE@)
+ find_dependency(CHOLMOD)
+ find_dependency(SPQR)
+endif()
@CUDAToolkit_DEPENDENCY@
@Threads_DEPENDENCY@

@@ -195,7 +198,7 @@
# 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(Eigen3 ${CERES_EIGEN_VERSION} QUIET)
+find_package(Eigen3 CONFIG ${CERES_EIGEN_VERSION} QUIET)
+find_dependency(Eigen3 CONFIG ${CERES_EIGEN_VERSION} QUIET)
if (Eigen3_FOUND)
if (NOT Eigen3_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
@@ -217,55 +217,8 @@ else (Eigen3_FOUND)
@@ -217,55 +220,7 @@
endif (Eigen3_FOUND)

# glog (and maybe gflags).
Expand Down Expand Up @@ -64,7 +76,6 @@ index ceb7e269..5dee7e3c 100644
- endif()
- endif()
-endif(CERES_USES_MINIGLOG)
+include(CMakeFindDependencyMacro)
+find_dependency(glog NO_MODULE)

# Import exported Ceres targets, if they have not already been imported.
Expand Down
10 changes: 7 additions & 3 deletions ports/ceres/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ceres",
"version": "2.2.0",
"port-version": 1,
"description": "non-linear optimization package",
"homepage": "https://github.com/ceres-solver/ceres-solver",
"license": "Apache-2.0",
Expand Down Expand Up @@ -49,9 +50,12 @@
]
},
{
"name": "suitesparse",
"default-features": false
}
"name": "suitesparse-cholmod",
"features": [
"matrixops"
]
},
"suitesparse-spqr"
]
},
"tools": {
Expand Down
1 change: 1 addition & 0 deletions ports/colmap/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "colmap",
"version": "3.11.1",
"port-version": 1,
"description": "COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface. It offers a wide range of features for reconstruction of ordered and unordered image collections. The software is licensed under the new BSD license.",
"homepage": "https://colmap.github.io/",
"license": "BSD-3-Clause",
Expand Down
1 change: 1 addition & 0 deletions ports/g2o/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ vcpkg_cmake_configure(
-DBUILD_LGPL_SHARED_LIBS=${BUILD_LGPL_SHARED_LIBS}
-DG2O_BUILD_EXAMPLES=OFF
-DG2O_BUILD_APPS=OFF
-DBUILD_CSPARSE=OFF
)

vcpkg_cmake_install()
Expand Down
5 changes: 3 additions & 2 deletions ports/g2o/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "g2o",
"version-date": "2024-12-14",
"port-version": 2,
"port-version": 3,
"description": "g2o: A General Framework for Graph Optimization",
"homepage": "https://openslam.org/g2o.html",
"dependencies": [
"ceres",
"eigen3",
"lapack",
"suitesparse",
"suitesparse-cholmod",
"suitesparse-cxsparse",
{
"name": "vcpkg-cmake",
"host": true
Expand Down
33 changes: 33 additions & 0 deletions ports/suitesparse-amd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DrTimothyAldenDavis/SuiteSparse
REF v7.8.3
SHA512 fc0fd0aaf55a6712a3b8ca23bf7536a31d52033e090370ebbf291f05d0e073c7dcfd991a80b037f54663f524804582b87af86522c2e4435091527f0d3c189244
HEAD_REF dev
)

set(PACKAGE_NAME AMD)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/${PACKAGE_NAME}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DSUITESPARSE_USE_CUDA=OFF
-DSUITESPARSE_USE_STRICT=ON
-DSUITESPARSE_USE_FORTRAN=OFF
-DSUITESPARSE_DEMOS=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(
PACKAGE_NAME ${PACKAGE_NAME}
CONFIG_PATH lib/cmake/${PACKAGE_NAME}
)
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${PACKAGE_NAME}/Doc/License.txt")
19 changes: 19 additions & 0 deletions ports/suitesparse-amd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$comment": "Use scripts/update_suitesparse.py to update all SuiteSparse ports",
"name": "suitesparse-amd",
"version-semver": "3.3.3",
"description": "AMD: Routines for permuting sparse matrices prior to factorization in SuiteSparse",
"homepage": "https://people.engr.tamu.edu/davis/suitesparse.html",
"license": "BSD-3-Clause",
"dependencies": [
"suitesparse-config",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
36 changes: 36 additions & 0 deletions ports/suitesparse-btf/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DrTimothyAldenDavis/SuiteSparse
REF v7.8.3
SHA512 fc0fd0aaf55a6712a3b8ca23bf7536a31d52033e090370ebbf291f05d0e073c7dcfd991a80b037f54663f524804582b87af86522c2e4435091527f0d3c189244
HEAD_REF dev
)

set(PACKAGE_NAME BTF)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/${PACKAGE_NAME}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DSUITESPARSE_USE_CUDA=OFF
-DSUITESPARSE_USE_STRICT=ON
-DSUITESPARSE_USE_FORTRAN=OFF
-DSUITESPARSE_DEMOS=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(
PACKAGE_NAME ${PACKAGE_NAME}
CONFIG_PATH lib/cmake/${PACKAGE_NAME}
)
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST
"${SOURCE_PATH}/${PACKAGE_NAME}/Doc/License.txt"
"${SOURCE_PATH}/${PACKAGE_NAME}/Doc/lesser.txt"
)
19 changes: 19 additions & 0 deletions ports/suitesparse-btf/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$comment": "Use scripts/update_suitesparse.py to update all SuiteSparse ports",
"name": "suitesparse-btf",
"version-semver": "2.3.2",
"description": "BTF: Software package for permuting a matrix into block upper triangular form in SuiteSparse",
"homepage": "https://people.engr.tamu.edu/davis/suitesparse.html",
"license": "LGPL-2.1-or-later",
"dependencies": [
"suitesparse-config",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
33 changes: 33 additions & 0 deletions ports/suitesparse-camd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DrTimothyAldenDavis/SuiteSparse
REF v7.8.3
SHA512 fc0fd0aaf55a6712a3b8ca23bf7536a31d52033e090370ebbf291f05d0e073c7dcfd991a80b037f54663f524804582b87af86522c2e4435091527f0d3c189244
HEAD_REF dev
)

set(PACKAGE_NAME CAMD)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/${PACKAGE_NAME}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DSUITESPARSE_USE_CUDA=OFF
-DSUITESPARSE_USE_STRICT=ON
-DSUITESPARSE_USE_FORTRAN=OFF
-DSUITESPARSE_DEMOS=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(
PACKAGE_NAME ${PACKAGE_NAME}
CONFIG_PATH lib/cmake/${PACKAGE_NAME}
)
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${PACKAGE_NAME}/Doc/License.txt")
19 changes: 19 additions & 0 deletions ports/suitesparse-camd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$comment": "Use scripts/update_suitesparse.py to update all SuiteSparse ports",
"name": "suitesparse-camd",
"version-semver": "3.3.3",
"description": "AMD: Routines for permuting sparse matrices prior to factorization in SuiteSparse",
"homepage": "https://people.engr.tamu.edu/davis/suitesparse.html",
"license": "BSD-3-Clause",
"dependencies": [
"suitesparse-config",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
33 changes: 33 additions & 0 deletions ports/suitesparse-ccolamd/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DrTimothyAldenDavis/SuiteSparse
REF v7.8.3
SHA512 fc0fd0aaf55a6712a3b8ca23bf7536a31d52033e090370ebbf291f05d0e073c7dcfd991a80b037f54663f524804582b87af86522c2e4435091527f0d3c189244
HEAD_REF dev
)

set(PACKAGE_NAME CCOLAMD)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/${PACKAGE_NAME}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
-DSUITESPARSE_USE_CUDA=OFF
-DSUITESPARSE_USE_STRICT=ON
-DSUITESPARSE_USE_FORTRAN=OFF
-DSUITESPARSE_DEMOS=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(
PACKAGE_NAME ${PACKAGE_NAME}
CONFIG_PATH lib/cmake/${PACKAGE_NAME}
)
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/${PACKAGE_NAME}/Doc/License.txt")
19 changes: 19 additions & 0 deletions ports/suitesparse-ccolamd/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$comment": "Use scripts/update_suitesparse.py to update all SuiteSparse ports",
"name": "suitesparse-ccolamd",
"version-semver": "3.3.4",
"description": "CCOLAMD: Routines for constrained column approximate minimum degree ordering algorithm in SuiteSparse",
"homepage": "https://people.engr.tamu.edu/davis/suitesparse.html",
"license": "BSD-3-Clause",
"dependencies": [
"suitesparse-config",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
Loading

0 comments on commit ab42fb3

Please sign in to comment.