aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ceres
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/ceres')
-rw-r--r--vcpkg/ports/ceres/0001_cmakelists_fixes.patch116
-rw-r--r--vcpkg/ports/ceres/0002_use_glog_target.patch13
-rw-r--r--vcpkg/ports/ceres/0004_remove_broken_fake_ba_jac.patch67
-rw-r--r--vcpkg/ports/ceres/0005_link_cuda_static.patch99
-rw-r--r--vcpkg/ports/ceres/0006_fix_cuda_architectures.patch49
-rw-r--r--vcpkg/ports/ceres/0007_support_cuda_13.patch43
-rw-r--r--vcpkg/ports/ceres/portfile.cmake76
-rw-r--r--vcpkg/ports/ceres/vcpkg.json66
8 files changed, 529 insertions, 0 deletions
diff --git a/vcpkg/ports/ceres/0001_cmakelists_fixes.patch b/vcpkg/ports/ceres/0001_cmakelists_fixes.patch
new file mode 100644
index 0000000..7e71e7f
--- /dev/null
+++ b/vcpkg/ports/ceres/0001_cmakelists_fixes.patch
@@ -0,0 +1,116 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8e49c19..4ea82bc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -292,10 +292,23 @@ if (SUITESPARSE)
+ # 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)
++ include(CheckCSourceCompiles)
++ block(SCOPE_FOR VARIABLES)
++ set(CMAKE_REQUIRED_INCLUDES "")
++ set(CMAKE_REQUIRED_LIBRARIES SuiteSparse::CHOLMOD)
++ set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
++ check_c_source_compiles([[
++ #include <cholmod.h>
++ #ifndef CHOLMOD_HAS_PARTITION
++ #error "partition not enabled"
++ #endif
++ ]] SuiteSparse_Partition_FOUND)
++ endblock()
++ find_package(SPQR CONFIG REQUIRED)
++ find_package(SuiteSparse NAMES SuiteSparse_config REQUIRED)
+ if (SuiteSparse_FOUND)
+- set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
++ set(SuiteSparse_DEPENDENCY "find_dependency(CHOLMOD CONFIG)\nfind_dependency(SPQR CONFIG)")
+ # By default, if all of SuiteSparse's dependencies are found, Ceres is
+ # built with SuiteSparse support.
+ message("-- Found SuiteSparse ${SuiteSparse_VERSION}, "
+@@ -323,13 +336,14 @@ if (NOT SuiteSparse_Partition_FOUND)
+ endif (NOT SuiteSparse_Partition_FOUND)
+
+ if (EIGENMETIS)
+- find_package (METIS)
++ find_package (METIS NAMES metis REQUIRED)
++ add_library(METIS::METIS ALIAS metis)
+ 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
+ # relying on Ceres. We do not actually need to propagate anything besides
+ # the link libraries (such as include directories.)
+- set(METIS_DEPENDENCY "find_dependency(METIS ${METIS_VERSION})")
++ set(METIS_DEPENDENCY "find_dependency(metis CONFIG)")
+ # METIS find module must be installed unless a package config is being used.
+ if (NOT METIS_DIR)
+ install(FILES ${Ceres_SOURCE_DIR}/cmake/FindMETIS.cmake
+@@ -433,7 +447,9 @@ else (MINIGLOG)
+ unset(MINIGLOG_MAX_LOG_LEVEL CACHE)
+ # Don't search with REQUIRED so that configuration continues if not found and
+ # we can output an error messages explaining MINIGLOG option.
+- find_package(Glog)
++ find_package(GLOG NAMES glog REQUIRED)
++ set(FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION TRUE)
++ set(GLOG_LIBRARIES glog::glog)
+ if (NOT GLOG_FOUND)
+ message(FATAL_ERROR "Can't find Google Log (glog). Please set either: "
+ "glog_DIR (newer CMake built versions of glog) or GLOG_INCLUDE_DIR & "
+diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in
+index ceb7e26..a5eb833 100644
+--- a/cmake/CeresConfig.cmake.in
++++ b/cmake/CeresConfig.cmake.in
+@@ -195,7 +195,7 @@ set(CERES_EIGEN_VERSION @Eigen3_VERSION@)
+ # 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_dependency(Eigen3 CONFIG ${CERES_EIGEN_VERSION})
+ if (Eigen3_FOUND)
+ if (NOT Eigen3_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
+ # CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
+@@ -233,7 +233,7 @@ if (CERES_USES_MINIGLOG)
+ "for glog, beware this will likely cause problems if glog is later linked.")
+ else(CERES_USES_MINIGLOG)
+ if (CERES_GLOG_WAS_BUILT_WITH_CMAKE)
+- find_package(glog ${CERES_GLOG_VERSION} CONFIG QUIET)
++ find_dependency(glog)
+ set(GLOG_FOUND ${glog_FOUND})
+ else()
+ # Version of glog against which Ceres was built was not built with CMake,
+diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
+index f9fc241..9f6f25b 100644
+--- a/internal/ceres/CMakeLists.txt
++++ b/internal/ceres/CMakeLists.txt
+@@ -104,15 +104,14 @@ if (SUITESPARSE AND SuiteSparse_FOUND)
+ SuiteSparse::SPQR)
+
+ if (SuiteSparse_Partition_FOUND)
+- list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::Partition)
+ endif (SuiteSparse_Partition_FOUND)
+ endif (SUITESPARSE AND SuiteSparse_FOUND)
+
+-if (SuiteSparse_Partition_FOUND OR EIGENMETIS)
++if (EIGENMETIS)
+ # Define version information for use in Solver::FullReport.
+ add_definitions(-DCERES_METIS_VERSION="${METIS_VERSION}")
+ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES METIS::METIS)
+-endif (SuiteSparse_Partition_FOUND OR EIGENMETIS)
++endif (EIGENMETIS)
+
+ if (ACCELERATESPARSE AND AccelerateSparse_FOUND)
+ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${AccelerateSparse_LIBRARIES})
+diff --git a/internal/ceres/solver_utils.cc b/internal/ceres/solver_utils.cc
+index 3356f3b..35a6109 100644
+--- a/internal/ceres/solver_utils.cc
++++ b/internal/ceres/solver_utils.cc
+@@ -62,7 +62,7 @@ constexpr char kVersion[] =
+ "-suitesparse-(" CERES_SUITESPARSE_VERSION ")"
+ #endif
+
+-#if !defined(CERES_NO_EIGEN_METIS) || !defined(CERES_NO_CHOLMOD_PARTITION)
++#if !defined(CERES_NO_EIGEN_METIS)
+ "-metis-(" CERES_METIS_VERSION ")"
+ #endif
+
diff --git a/vcpkg/ports/ceres/0002_use_glog_target.patch b/vcpkg/ports/ceres/0002_use_glog_target.patch
new file mode 100644
index 0000000..fcaefe7
--- /dev/null
+++ b/vcpkg/ports/ceres/0002_use_glog_target.patch
@@ -0,0 +1,13 @@
+diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
+index f9fc2415..0aaabe4d 100644
+--- a/internal/ceres/CMakeLists.txt
++++ b/internal/ceres/CMakeLists.txt
+@@ -85,7 +85,7 @@ endif (SCHUR_SPECIALIZATIONS)
+ SKIP_UNITY_BUILD_INCLUSION ON)
+
+ if (NOT MINIGLOG AND GLOG_FOUND)
+- list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES})
++ list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog)
+ 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
diff --git a/vcpkg/ports/ceres/0004_remove_broken_fake_ba_jac.patch b/vcpkg/ports/ceres/0004_remove_broken_fake_ba_jac.patch
new file mode 100644
index 0000000..3862869
--- /dev/null
+++ b/vcpkg/ports/ceres/0004_remove_broken_fake_ba_jac.patch
@@ -0,0 +1,67 @@
+diff --git a/internal/ceres/fake_bundle_adjustment_jacobian.cc b/internal/ceres/fake_bundle_adjustment_jacobian.cc
+index efe4d8d7..22f34059 100644
+--- a/internal/ceres/fake_bundle_adjustment_jacobian.cc
++++ b/internal/ceres/fake_bundle_adjustment_jacobian.cc
+@@ -96,25 +96,4 @@ std::unique_ptr<BlockSparseMatrix> CreateFakeBundleAdjustmentJacobian(
+ return jacobian;
+ }
+
+-std::pair<
+- std::unique_ptr<PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>>,
+- std::unique_ptr<BlockSparseMatrix>>
+-CreateFakeBundleAdjustmentPartitionedJacobian(int num_cameras,
+- int num_points,
+- int camera_size,
+- int landmark_size,
+- double visibility,
+- std::mt19937& rng) {
+- using PartitionedView =
+- PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>;
+- auto block_sparse_matrix = CreateFakeBundleAdjustmentJacobian(
+- num_cameras, num_points, camera_size, landmark_size, visibility, rng);
+- LinearSolver::Options options;
+- options.elimination_groups.push_back(num_points);
+- auto partitioned_view =
+- std::make_unique<PartitionedView>(options, *block_sparse_matrix);
+- return std::make_pair(std::move(partitioned_view),
+- std::move(block_sparse_matrix));
+-}
+-
+ } // namespace ceres::internal
+diff --git a/internal/ceres/fake_bundle_adjustment_jacobian.h b/internal/ceres/fake_bundle_adjustment_jacobian.h
+index ced1b161..0448dbf3 100644
+--- a/internal/ceres/fake_bundle_adjustment_jacobian.h
++++ b/internal/ceres/fake_bundle_adjustment_jacobian.h
+@@ -47,32 +47,6 @@ std::unique_ptr<BlockSparseMatrix> CreateFakeBundleAdjustmentJacobian(
+ double visibility,
+ std::mt19937& prng);
+
+-template <int kEBlockSize = 3, int kFBlockSize = 6>
+-std::pair<std::unique_ptr<PartitionedMatrixView<2, kEBlockSize, kFBlockSize>>,
+- std::unique_ptr<BlockSparseMatrix>>
+-CreateFakeBundleAdjustmentPartitionedJacobian(int num_cameras,
+- int num_points,
+- double visibility,
+- std::mt19937& rng) {
+- using PartitionedView = PartitionedMatrixView<2, kEBlockSize, kFBlockSize>;
+- auto block_sparse_matrix = CreateFakeBundleAdjustmentJacobian(
+- num_cameras, num_points, kFBlockSize, kEBlockSize, visibility, rng);
+- auto partitioned_view =
+- std::make_unique<PartitionedView>(*block_sparse_matrix, num_points);
+- return std::make_pair(std::move(partitioned_view),
+- std::move(block_sparse_matrix));
+-}
+-
+-std::pair<
+- std::unique_ptr<PartitionedMatrixView<2, Eigen::Dynamic, Eigen::Dynamic>>,
+- std::unique_ptr<BlockSparseMatrix>>
+-CreateFakeBundleAdjustmentPartitionedJacobian(int num_cameras,
+- int num_points,
+- int camera_size,
+- int landmark_size,
+- double visibility,
+- std::mt19937& rng);
+-
+ } // namespace ceres::internal
+
+ #endif // CERES_INTERNAL_FAKE_BUNDLE_ADJUSTMENT_JACOBIAN
diff --git a/vcpkg/ports/ceres/0005_link_cuda_static.patch b/vcpkg/ports/ceres/0005_link_cuda_static.patch
new file mode 100644
index 0000000..4152fed
--- /dev/null
+++ b/vcpkg/ports/ceres/0005_link_cuda_static.patch
@@ -0,0 +1,99 @@
+commit d0b87157ab0e27e9e4cf2ea27967b5d619e81a76
+Author: Markus Heß <hess@3dvisionlabs.com>
+Date: Sat Mar 2 13:28:02 2024 +0000
+
+ Link static cuda libs when ceres is build static
+
+ Change-Id: I8821a2df5302cf164b6f80d6787ae795691d6b32
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4ea82bcd..9729ccc2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -126,7 +126,7 @@ if (APPLE)
+ endif()
+ # We can't have an option called 'CUDA' since that is a reserved word -- a
+ # language definition.
+-option(USE_CUDA "Enable use of CUDA linear algebra solvers." ON)
++set(USE_CUDA "default" CACHE STRING "Enable use of CUDA linear algebra solvers.")
+ option(LAPACK "Enable use of LAPACK directly within Ceres." ON)
+ # Template specializations for the Schur complement based solvers. If
+ # compile time, binary size or compiler performance is an issue, you
+@@ -204,6 +204,12 @@ if (Eigen3_FOUND)
+ endif (EIGENSPARSE)
+ endif (Eigen3_FOUND)
+
++if (CMAKE_VERSION VERSION_LESS 3.17)
++ set_property(CACHE USE_CUDA PROPERTY STRINGS OFF default)
++else (CMAKE_VERSION VERSION_LESS 3.17)
++ set_property(CACHE USE_CUDA PROPERTY STRINGS OFF default static)
++endif (CMAKE_VERSION VERSION_LESS 3.17)
++
+ if (USE_CUDA)
+ if (CMAKE_VERSION VERSION_LESS 3.17)
+ # On older versions of CMake (20.04 default is 3.16) FindCUDAToolkit was
+@@ -233,6 +239,7 @@ if (USE_CUDA)
+ declare_imported_cuda_target(cusparse)
+ declare_imported_cuda_target(cudart ${CUDA_LIBRARIES})
+
++ set(CERES_CUDA_TARGET_SUFFIX "")
+ set(CUDAToolkit_BIN_DIR ${CUDA_TOOLKIT_ROOT_DIR}/bin)
+
+ else (CUDA_FOUND)
+@@ -252,22 +259,31 @@ if (USE_CUDA)
+ set(CMAKE_CUDA_ARCHITECTURES "50;60;70;80")
+ message("-- Setting CUDA Architecture to ${CMAKE_CUDA_ARCHITECTURES}")
+ endif()
+- list(APPEND CERES_CUDA_LIBRARIES
+- CUDA::cublas
+- CUDA::cudart
+- CUDA::cusolver
+- CUDA::cusparse)
+- set(CMAKE_CUDA_RUNTIME_LIBRARY NONE)
++
++ if (USE_CUDA STREQUAL "static")
++ set(CERES_CUDA_TARGET_SUFFIX "_static")
++ else (USE_CUDA STREQUAL "static")
++ set(CERES_CUDA_TARGET_SUFFIX "")
++ endif (USE_CUDA STREQUAL "static")
+ else (CUDAToolkit_FOUND)
+ message("-- Did not find CUDA, disabling CUDA support.")
+ update_cache_variable(USE_CUDA OFF)
+ endif (CUDAToolkit_FOUND)
+ endif (CMAKE_VERSION VERSION_LESS 3.17)
+ endif (USE_CUDA)
+-if (NOT USE_CUDA)
++
++if (USE_CUDA)
++ list(APPEND CERES_CUDA_LIBRARIES
++ CUDA::cublas${CERES_CUDA_TARGET_SUFFIX}
++ CUDA::cudart${CERES_CUDA_TARGET_SUFFIX}
++ CUDA::cusolver${CERES_CUDA_TARGET_SUFFIX}
++ CUDA::cusparse${CERES_CUDA_TARGET_SUFFIX})
++ unset (CERES_CUDA_TARGET_SUFFIX)
++ set(CMAKE_CUDA_RUNTIME_LIBRARY NONE)
++else (USE_CUDA)
+ message("-- Building without CUDA.")
+ list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDA)
+-endif (NOT USE_CUDA)
++endif (USE_CUDA)
+
+ if (LAPACK)
+ find_package(LAPACK QUIET)
+diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
+index eecef260..b7e31ee6 100644
+--- a/internal/ceres/CMakeLists.txt
++++ b/internal/ceres/CMakeLists.txt
+@@ -118,11 +118,7 @@ if (ACCELERATESPARSE AND AccelerateSparse_FOUND)
+ endif()
+
+ if (USE_CUDA)
+- list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES
+- CUDA::cublas
+- CUDA::cudart
+- CUDA::cusolver
+- CUDA::cusparse)
++ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CERES_CUDA_LIBRARIES})
+ set_source_files_properties(cuda_kernels_vector_ops.cu.cc PROPERTIES LANGUAGE CUDA)
+ set_source_files_properties(cuda_kernels_bsm_to_crs.cu.cc PROPERTIES LANGUAGE CUDA)
+ add_library(ceres_cuda_kernels STATIC cuda_kernels_vector_ops.cu.cc cuda_kernels_bsm_to_crs.cu.cc)
diff --git a/vcpkg/ports/ceres/0006_fix_cuda_architectures.patch b/vcpkg/ports/ceres/0006_fix_cuda_architectures.patch
new file mode 100644
index 0000000..acc2924
--- /dev/null
+++ b/vcpkg/ports/ceres/0006_fix_cuda_architectures.patch
@@ -0,0 +1,49 @@
+commit 4939da2d6bbd8652020dc970ea0405d634e3550f
+Author: Markus Hess <hess@3dvisionlabs.com>
+Date: Thu Jun 6 12:44:55 2024 +0000
+
+ Set CMAKE_CUDA_ARCHITECTURES depending on CUDAToolkit_VERSION
+
+ Compilation fails if the CUDA architecture is not supported by the
+ installed version of the CUDA toolkit. This commit sets the
+ CMAKE_CUDA_ARCHITECTURES depending on the the installed CUDA toolkit
+ version.
+
+ Change-Id: I4765512279ee56897388e6ea22b961aebeb0fbca
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9729ccc2..bfa2d8ff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -255,8 +255,29 @@ if (USE_CUDA)
+ "find_dependency(CUDAToolkit ${CUDAToolkit_VERSION})")
+ enable_language(CUDA)
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
+- # Support Maxwell, Pascal, Volta, Turing, and Ampere GPUs.
+- set(CMAKE_CUDA_ARCHITECTURES "50;60;70;80")
++ # Support Maxwell GPUs (Default).
++ set(CMAKE_CUDA_ARCHITECTURES "50")
++ # Support other architectures depending on CUDA toolkit version.
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
++ # Support Pascal GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "60")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
++ # Support Volta GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "70")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "10.0")
++ # Support Turing GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "75")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "10.0")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.0")
++ # Support Ampere GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "80")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.0")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.8")
++ # Support Hopper GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "90")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.8")
+ message("-- Setting CUDA Architecture to ${CMAKE_CUDA_ARCHITECTURES}")
+ endif()
+
diff --git a/vcpkg/ports/ceres/0007_support_cuda_13.patch b/vcpkg/ports/ceres/0007_support_cuda_13.patch
new file mode 100644
index 0000000..0e74690
--- /dev/null
+++ b/vcpkg/ports/ceres/0007_support_cuda_13.patch
@@ -0,0 +1,43 @@
+commit d9d0c4d0e0cc560b7a3556284201537859b16fc6
+Author: Mackay <1.732mackay@gmail.com>
+Date: Wed Aug 6 21:36:12 2025 -0400
+
+ Update CMakeLists.txt to support CUDA 13
+
+ Change-Id: I4a0a0b29a45c1108d27b6f85670c926f5dda0f5e
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index bfa2d8ff..7e7e413d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -255,17 +255,19 @@ if (USE_CUDA)
+ "find_dependency(CUDAToolkit ${CUDAToolkit_VERSION})")
+ enable_language(CUDA)
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
+- # Support Maxwell GPUs (Default).
+- set(CMAKE_CUDA_ARCHITECTURES "50")
+- # Support other architectures depending on CUDA toolkit version.
+- if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
+- # Support Pascal GPUs.
+- list(APPEND CMAKE_CUDA_ARCHITECTURES "60")
+- endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
+- if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
+- # Support Volta GPUs.
+- list(APPEND CMAKE_CUDA_ARCHITECTURES "70")
+- endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
++ set(CMAKE_CUDA_ARCHITECTURES "")
++ if (CUDAToolkit_VERSION VERSION_LESS "13.0")
++ # Support Maxwell GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "50")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
++ # Support Pascal GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "60")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "8.0")
++ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
++ # Support Volta GPUs.
++ list(APPEND CMAKE_CUDA_ARCHITECTURES "70")
++ endif(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "9.0")
++ endif(CUDAToolkit_VERSION VERSION_LESS "13.0")
+ if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "10.0")
+ # Support Turing GPUs.
+ list(APPEND CMAKE_CUDA_ARCHITECTURES "75")
diff --git a/vcpkg/ports/ceres/portfile.cmake b/vcpkg/ports/ceres/portfile.cmake
new file mode 100644
index 0000000..9366f67
--- /dev/null
+++ b/vcpkg/ports/ceres/portfile.cmake
@@ -0,0 +1,76 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ceres-solver/ceres-solver
+ REF 85331393dc0dff09f6fb9903ab0c4bfa3e134b01 #2.2.0
+ SHA512 16d3f4f3524b7532f666c0a626f1c678170698119eff3d914ade2e7cc65f25e644c2eabb618cd5805cba0fd4e08d3f64658a9f480934d8aace4089ec42b3d691
+ HEAD_REF master
+ PATCHES
+ 0001_cmakelists_fixes.patch
+ 0004_remove_broken_fake_ba_jac.patch
+ 0005_link_cuda_static.patch
+ 0006_fix_cuda_architectures.patch
+ 0007_support_cuda_13.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/FindMETIS.cmake")
+file(REMOVE "${SOURCE_PATH}/cmake/FindSuiteSparse.cmake")
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "cuda" USE_CUDA
+ "eigensparse" EIGENSPARSE
+ "lapack" LAPACK
+ "schur" SCHUR_SPECIALIZATIONS
+ "suitesparse" SUITESPARSE
+)
+
+if(VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP)
+ list(APPEND FEATURE_OPTIONS -DMINIGLOG=ON)
+endif()
+
+if("cuda" IN_LIST FEATURES)
+ vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT cuda_toolkit_root)
+ list(APPEND FEATURE_OPTIONS
+ "-DCMAKE_CUDA_COMPILER=${NVCC}"
+ "-DCUDAToolkit_ROOT=${cuda_toolkit_root}"
+ )
+endif()
+
+if(VCPKG_TARGET_IS_IOS)
+ # Note: CMake uses "OSX" not just for macOS, but also iOS, watchOS and tvOS.
+ list(APPEND FEATURE_OPTIONS "-DIOS_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}")
+endif()
+
+# Add big object support for MinGW
+if(VCPKG_TARGET_IS_MINGW)
+ list(APPEND FEATURE_OPTIONS "-DCMAKE_CXX_FLAGS=-Wa,-mbig-obj")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DEXPORT_BUILD_DIR=ON
+ -DBUILD_BENCHMARKS=OFF
+ -DBUILD_EXAMPLES=OFF
+ -DBUILD_TESTING=OFF
+ -DPROVIDE_UNINSTALL_TARGET=OFF
+ -DMSVC_USE_STATIC_CRT=${MSVC_USE_STATIC_CRT_VALUE}
+ -DVCPKG_LOCK_FIND_PACKAGE_CUDAToolkit=ON
+ -DVCPKG_LOCK_FIND_PACKAGE_gflags=OFF # No direct use except examples+tests
+ -DVCPKG_LOCK_FIND_PACKAGE_LAPACK=ON
+ MAYBE_UNUSED_VARIABLES
+ MSVC_USE_STATIC_CRT
+ VCPKG_LOCK_FIND_PACKAGE_CUDAToolkit
+ VCPKG_LOCK_FIND_PACKAGE_LAPACK
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/Ceres")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/ceres/vcpkg.json b/vcpkg/ports/ceres/vcpkg.json
new file mode 100644
index 0000000..7b67d6f
--- /dev/null
+++ b/vcpkg/ports/ceres/vcpkg.json
@@ -0,0 +1,66 @@
+{
+ "name": "ceres",
+ "version": "2.2.0",
+ "port-version": 5,
+ "description": "non-linear optimization package",
+ "homepage": "https://github.com/ceres-solver/ceres-solver",
+ "license": "Apache-2.0",
+ "dependencies": [
+ "eigen3",
+ {
+ "name": "glog",
+ "platform": "!ios & !uwp"
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "cuda": {
+ "description": "Support for CUDA based dense solvers",
+ "dependencies": [
+ "cuda"
+ ]
+ },
+ "eigensparse": {
+ "description": "Use of Eigen as a sparse linear algebra library in Ceres",
+ "dependencies": [
+ "metis"
+ ]
+ },
+ "lapack": {
+ "description": "Use Lapack in Ceres",
+ "dependencies": [
+ "lapack"
+ ]
+ },
+ "schur": {
+ "description": "Enable fixed-size Schur specializations in Ceres"
+ },
+ "suitesparse": {
+ "description": "SuiteSparse support for Ceres",
+ "dependencies": [
+ {
+ "name": "ceres",
+ "features": [
+ "lapack"
+ ]
+ },
+ {
+ "name": "suitesparse-cholmod",
+ "default-features": false,
+ "features": [
+ "matrixops"
+ ]
+ },
+ "suitesparse-config",
+ "suitesparse-spqr"
+ ]
+ }
+ }
+}