From 9196d10ded0532c304d5fbdd900e90567ce7de2f Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Fri, 1 Aug 2025 03:19:10 +0200 Subject: [PATCH] [ceres] Fix dependencies, cleanup (#46669) --- ports/ceres/0001_cmakelists_fixes.patch | 160 ++++++++++++------ ports/ceres/0002_use_glog_target.patch | 22 +-- .../0003_fix_exported_ceres_config.patch | 82 --------- ports/ceres/0005_find_package_required.patch | 56 ------ ...0006_use_official_suitesparse_config.patch | 39 ----- ports/ceres/0007_use_metis_config.patch | 11 -- ports/ceres/portfile.cmake | 54 ++---- ports/ceres/vcpkg.json | 13 +- scripts/ci.feature.baseline.txt | 3 - versions/baseline.json | 2 +- versions/c-/ceres.json | 5 + 11 files changed, 143 insertions(+), 304 deletions(-) delete mode 100644 ports/ceres/0003_fix_exported_ceres_config.patch delete mode 100644 ports/ceres/0005_find_package_required.patch delete mode 100644 ports/ceres/0006_use_official_suitesparse_config.patch delete mode 100644 ports/ceres/0007_use_metis_config.patch diff --git a/ports/ceres/0001_cmakelists_fixes.patch b/ports/ceres/0001_cmakelists_fixes.patch index d2a37d682d..7e71e7f0f7 100644 --- a/ports/ceres/0001_cmakelists_fixes.patch +++ b/ports/ceres/0001_cmakelists_fixes.patch @@ -1,56 +1,116 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8e49c19e..f8c61d92 100644 +index 8e49c19..4ea82bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -430,28 +430,7 @@ if (MINIGLOG) - mark_as_advanced(FORCE GLOG_INCLUDE_DIR - GLOG_LIBRARY) - 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. +@@ -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 ++ #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) -- 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 & " -- "GLOG_LIBRARY or enable MINIGLOG option to use minimal glog " -- "implementation.") -- endif(NOT GLOG_FOUND) -- # By default, assume gflags was found, updating the message if it was not. -- 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) -- 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) -- message("-- Found Google Log (glog)." ${GLOG_GFLAGS_DEPENDENCY_MESSAGE}) -+ find_package(Glog REQUIRED) - endif (MINIGLOG) - - if (NOT SCHUR_SPECIALIZATIONS) -@@ -466,7 +445,7 @@ endif (NOT CUSTOM_BLAS) - - if (BUILD_BENCHMARKS) - # Version 1.3 was first to provide import targets -- find_package(benchmark 1.3 QUIET) -+ find_package(benchmark CONFIG REQUIRED) - if (benchmark_FOUND) - message("-- Found Google benchmark library. Building Ceres benchmarks.") ++ 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() -@@ -722,12 +705,6 @@ install(FILES "${Ceres_BINARY_DIR}/CeresConfig-install.cmake" - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) - install(FILES "${Ceres_BINARY_DIR}/CeresConfigVersion.cmake" - DESTINATION ${RELATIVE_CMAKECONFIG_INSTALL_DIR}) --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() + # 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 - if (PROVIDE_UNINSTALL_TARGET) - # Create an uninstall target to remove all installed files. diff --git a/ports/ceres/0002_use_glog_target.patch b/ports/ceres/0002_use_glog_target.patch index 806025c270..fcaefe71e6 100644 --- a/ports/ceres/0002_use_glog_target.patch +++ b/ports/ceres/0002_use_glog_target.patch @@ -2,24 +2,12 @@ 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,17 +85,9 @@ endif (SCHUR_SPECIALIZATIONS) - set_source_files_properties(${CERES_INTERNAL_SCHUR_FILES} PROPERTIES +@@ -85,7 +85,7 @@ endif (SCHUR_SPECIALIZATIONS) SKIP_UNITY_BUILD_INCLUSION ON) --if (NOT MINIGLOG AND GLOG_FOUND) + if (NOT MINIGLOG AND GLOG_FOUND) - list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES}) -- 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) -- endif() --endif (NOT MINIGLOG AND GLOG_FOUND) -+if (NOT MINIGLOG) + list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES glog::glog) -+endif (NOT MINIGLOG) - - if (SUITESPARSE AND SuiteSparse_FOUND) - # Define version information for use in Solver::FullReport. + 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/ports/ceres/0003_fix_exported_ceres_config.patch b/ports/ceres/0003_fix_exported_ceres_config.patch deleted file mode 100644 index b2c098a83f..0000000000 --- a/ports/ceres/0003_fix_exported_ceres_config.patch +++ /dev/null @@ -1,82 +0,0 @@ -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 -@@ -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_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 +220,7 @@ - endif (Eigen3_FOUND) - - # 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) -- # Output message at standard log level (not the lower STATUS) so that -- # the message is output in GUI during configuration to warn user. -- 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) -- if (CERES_GLOG_WAS_BUILT_WITH_CMAKE) -- find_package(glog ${CERES_GLOG_VERSION} CONFIG QUIET) -- set(GLOG_FOUND ${glog_FOUND}) -- else() -- # 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() -- -- if (GLOG_FOUND) -- 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) -- # Search quietly s/t we control the timing of the error message if not found. -- 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 (not found, or not found as exported CMake target).") -- endif() -- endif() --endif(CERES_USES_MINIGLOG) -+find_dependency(glog NO_MODULE) - - # Import exported Ceres targets, if they have not already been imported. - if (NOT TARGET ceres AND NOT Ceres_BINARY_DIR) diff --git a/ports/ceres/0005_find_package_required.patch b/ports/ceres/0005_find_package_required.patch deleted file mode 100644 index a73db1ddf5..0000000000 --- a/ports/ceres/0005_find_package_required.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- 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}") diff --git a/ports/ceres/0006_use_official_suitesparse_config.patch b/ports/ceres/0006_use_official_suitesparse_config.patch deleted file mode 100644 index 14eebb834c..0000000000 --- a/ports/ceres/0006_use_official_suitesparse_config.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- 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 -+ $,SuiteSparse::CHOLMOD,SuiteSparse::CHOLMOD_static> -+ $,SuiteSparse::SPQR,SuiteSparse::SPQR_static>) - - if (SuiteSparse_Partition_FOUND) - list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::Partition) diff --git a/ports/ceres/0007_use_metis_config.patch b/ports/ceres/0007_use_metis_config.patch deleted file mode 100644 index 9b48a99bc6..0000000000 --- a/ports/ceres/0007_use_metis_config.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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) diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index f2782ffe45..36fe4725a9 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -1,11 +1,3 @@ -set(MSVC_USE_STATIC_CRT_VALUE OFF) -if(VCPKG_CRT_LINKAGE STREQUAL "static") - if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - message(FATAL_ERROR "Ceres does not support mixing static CRT and dynamic library linkage") - endif() - set(MSVC_USE_STATIC_CRT_VALUE ON) -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ceres-solver/ceres-solver @@ -14,14 +6,8 @@ vcpkg_from_github( HEAD_REF master PATCHES 0001_cmakelists_fixes.patch - 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") @@ -30,57 +16,53 @@ 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 - "lapack" LAPACK - "eigensparse" EIGENSPARSE - "tools" GFLAGS - "cuda" CUDA ) -if(VCPKG_TARGET_IS_UWP) + +if(VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP) list(APPEND FEATURE_OPTIONS -DMINIGLOG=ON) endif() -foreach (FEATURE ${FEATURE_OPTIONS}) - message(STATUS "${FEATURE}") -endforeach() - -set(USE_CUDA OFF) if("cuda" IN_LIST FEATURES) - set(USE_CUDA ON) + vcpkg_find_cuda(OUT_CUDA_TOOLKIT_ROOT cuda_toolkit_root) + list(APPEND FEATURE_OPTIONS + "-DCMAKE_CUDA_COMPILER=${NVCC}" + "-DCUDAToolkit_ROOT=${cuda_toolkit_root}" + ) endif() -set(TARGET_OPTIONS ) if(VCPKG_TARGET_IS_IOS) # Note: CMake uses "OSX" not just for macOS, but also iOS, watchOS and tvOS. - list(APPEND TARGET_OPTIONS "-DIOS_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}") + list(APPEND FEATURE_OPTIONS "-DIOS_DEPLOYMENT_TARGET=${VCPKG_OSX_DEPLOYMENT_TARGET}") endif() vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS ${FEATURE_OPTIONS} - ${TARGET_OPTIONS} -DEXPORT_BUILD_DIR=ON -DBUILD_BENCHMARKS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF - -DBUILD_BENCHMARKS=OFF - -DUSE_CUDA=${USE_CUDA} -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 - CUDA MSVC_USE_STATIC_CRT + VCPKG_LOCK_FIND_PACKAGE_CUDAToolkit + VCPKG_LOCK_FIND_PACKAGE_LAPACK ) - vcpkg_cmake_install() - -vcpkg_cmake_config_fixup(CONFIG_PATH "lib${LIB_SUFFIX}/cmake/Ceres") - 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") -file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/ceres/vcpkg.json b/ports/ceres/vcpkg.json index 47d55a364f..e68fde7450 100644 --- a/ports/ceres/vcpkg.json +++ b/ports/ceres/vcpkg.json @@ -1,7 +1,7 @@ { "name": "ceres", "version": "2.2.0", - "port-version": 2, + "port-version": 3, "description": "non-linear optimization package", "homepage": "https://github.com/ceres-solver/ceres-solver", "license": "Apache-2.0", @@ -9,7 +9,7 @@ "eigen3", { "name": "glog", - "platform": "!(arm & uwp)" + "platform": "!ios & !uwp" }, { "name": "vcpkg-cmake", @@ -23,7 +23,6 @@ "features": { "cuda": { "description": "Support for CUDA based dense solvers", - "supports": "linux | (!osx & !uwp & !(arm64 & windows))", "dependencies": [ "cuda" ] @@ -54,18 +53,14 @@ }, { "name": "suitesparse-cholmod", + "default-features": false, "features": [ "matrixops" ] }, + "suitesparse-config", "suitesparse-spqr" ] - }, - "tools": { - "description": "Ceres tools", - "dependencies": [ - "gflags" - ] } } } diff --git a/scripts/ci.feature.baseline.txt b/scripts/ci.feature.baseline.txt index 4756efa085..f0b4fb76b6 100644 --- a/scripts/ci.feature.baseline.txt +++ b/scripts/ci.feature.baseline.txt @@ -711,9 +711,6 @@ cairomm:x64-uwp = cascade cartographer:arm64-uwp = cascade cartographer:x64-uwp = cascade cctz:arm64-uwp = cascade -ceres:x64-uwp = cascade -ceres[cuda]:x86-windows = cascade -ceres[tools]:arm64-uwp = cascade cgal:arm64-uwp = cascade cgal:x64-uwp = cascade cgal[qt]:arm64-windows = cascade diff --git a/versions/baseline.json b/versions/baseline.json index edbd2f5dfc..d584dcc23c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -1642,7 +1642,7 @@ }, "ceres": { "baseline": "2.2.0", - "port-version": 2 + "port-version": 3 }, "cfitsio": { "baseline": "3.49", diff --git a/versions/c-/ceres.json b/versions/c-/ceres.json index 8fbaa40ea7..3fca1d594f 100644 --- a/versions/c-/ceres.json +++ b/versions/c-/ceres.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b1913608889f8a846b03535473b16f60a2b3b5d1", + "version": "2.2.0", + "port-version": 3 + }, { "git-tree": "e18de40c8d263f3f8d08782939cd3dd6bb5d4a6a", "version": "2.2.0",