瀏覽代碼

ceres-solver: fix build (#8565)

* ceres-solver: fix build

* update

* update
choyy 1 月之前
父節點
當前提交
68c4a5fe51
共有 2 個文件被更改,包括 23 次插入20 次删除
  1. 16 16
      packages/c/ceres-solver/patches/2.2.0/suitesparse.patch
  2. 7 4
      packages/c/ceres-solver/xmake.lua

+ 16 - 16
packages/c/ceres-solver/patches/2.2.0/suitesparse.patch

@@ -1,8 +1,8 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8e49c19..9ef55e2 100644
+index 8e49c19e..460e9b1a 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -292,20 +292,19 @@ if (SUITESPARSE)
+@@ -292,20 +292,18 @@ if (SUITESPARSE)
    # built with SuiteSparse support.
  
    # Check for SuiteSparse and dependencies.
@@ -10,13 +10,13 @@ index 8e49c19..9ef55e2 100644
 -    OPTIONAL_COMPONENTS Partition)
 +  find_package(CHOLMOD REQUIRED)
 +  find_package(SPQR REQUIRED)
-+  add_library (SuiteSparse::Partition IMPORTED INTERFACE)
-+  set_property (TARGET SuiteSparse::Partition APPEND PROPERTY INTERFACE_LINK_LIBRARIES SuiteSparse::CHOLMOD)
 +  set(SuiteSparse_FOUND TRUE)
 +  set(SuiteSparse_Partition_FOUND TRUE)
 +  set(SuiteSparse_VERSION ${SUITESPARSE_CONFIG_VERSION})
    if (SuiteSparse_FOUND)
-     set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
+-    set(SuiteSparse_DEPENDENCY "find_dependency(SuiteSparse ${SuiteSparse_VERSION})")
++    set(SuiteSparse_DEPENDENCY "find_dependency(CHOLMOD)
++                                find_dependency(SPQR)")
      # By default, if all of SuiteSparse's dependencies are found, Ceres is
      # built with SuiteSparse support.
      message("-- Found SuiteSparse ${SuiteSparse_VERSION}, "
@@ -31,17 +31,17 @@ index 8e49c19..9ef55e2 100644
      # Disable use of SuiteSparse if it cannot be found and continue.
      message("-- Did not find all SuiteSparse dependencies, disabling "
 diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt
-index f9fc241..55a3ceb 100644
+index f9fc2415..f457c90c 100644
 --- a/internal/ceres/CMakeLists.txt
 +++ b/internal/ceres/CMakeLists.txt
-@@ -33,7 +33,9 @@
- # Avoid 'xxx.cc has no symbols' warnings from source files which are 'empty'
- # when their enclosing #ifdefs are disabled.
- find_package(Threads REQUIRED)
--list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES Threads::Threads)
-+include(FindPkgConfig)
-+pkg_search_module(gklib REQUIRED IMPORTED_TARGET gklib)
-+list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES Threads::Threads PkgConfig::gklib)
- # Make dependency visible to the parent CMakeLists.txt
- set(Threads_DEPENDENCY "find_dependency (Threads)" PARENT_SCOPE)
+@@ -102,10 +102,6 @@ if (SUITESPARSE AND SuiteSparse_FOUND)
+   add_definitions(-DCERES_SUITESPARSE_VERSION="${SuiteSparse_VERSION}")
+   list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES SuiteSparse::CHOLMOD
+     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)

+ 7 - 4
packages/c/ceres-solver/xmake.lua

@@ -3,21 +3,24 @@ package("ceres-solver")
     set_description("Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems.")
     set_license("BSD-3-Clause")
     
-    add_urls("http://ceres-solver.org/ceres-solver-$(version).tar.gz")
+    add_urls("http://ceres-solver.org/ceres-solver-$(version).tar.gz",
+             "https://github.com/ceres-solver/ceres-solver/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/ceres-solver/ceres-solver.git")
     add_versions("2.0.0", "10298a1d75ca884aa0507d1abb0e0f04800a92871cd400d4c361b56a777a7603")
     add_versions("2.1.0", "f7d74eecde0aed75bfc51ec48c91d01fe16a6bf16bce1987a7073286701e2fc6")
     add_versions("2.2.0", "48b2302a7986ece172898477c3bcd6deb8fb5cf19b3327bc49969aad4cede82d")
 
     add_patches("2.1.0", "patches/2.1.0/int64.patch", "1df14f30abf1a942204b408c780eabbeac0859ba5a6db3459b55c47479583c57")
-    add_patches("2.2.0", "patches/2.2.0/suitesparse.patch", "1eaa17d98a99e8f5ac5a75f8685ee165bd1e05f5ea6da3774b4933de4084e3b5")
+    add_patches("2.2.0", "patches/2.2.0/suitesparse.patch", "3af807aec867512dbb18ac7a912dbdb1e1f66f3c8f2976c96d09ead80456beb8")
 
     add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
     add_configs("suitesparse", {description = "Enable SuiteSparse.", default = true, type = "boolean"})
     add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
 
-    add_deps("cmake", "eigen", "glog", "gflags", "pkgconf")
+    add_deps("cmake", "eigen <5.0", "glog")
 
     on_load(function (package)
+        package:add("deps", "metis", {configs = {shared = package:config("shared")}})
         if package:config("suitesparse") then
             package:add("deps", "suitesparse", {configs = {blas = package:config("blas")}})
             package:add("deps", "openmp")
@@ -33,7 +36,7 @@ package("ceres-solver")
             "-DBUILD_DOCUMENTATION=OFF",
             "-DBUILD_EXAMPLES=OFF",
             "-DBUILD_BENCHMARKS=OFF",
-            "-DCXSPARSE=OFF"
+            "-DGFLAGS=OFF",
         }
 
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))