xmake.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("ceres-solver")
  2. set_homepage("http://ceres-solver.org/")
  3. set_description("Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems.")
  4. set_license("BSD-3-Clause")
  5. add_urls("http://ceres-solver.org/ceres-solver-$(version).tar.gz")
  6. add_versions("2.0.0", "10298a1d75ca884aa0507d1abb0e0f04800a92871cd400d4c361b56a777a7603")
  7. add_versions("2.1.0", "f7d74eecde0aed75bfc51ec48c91d01fe16a6bf16bce1987a7073286701e2fc6")
  8. add_versions("2.2.0", "48b2302a7986ece172898477c3bcd6deb8fb5cf19b3327bc49969aad4cede82d")
  9. add_patches("2.1.0", "patches/2.1.0/int64.patch", "1df14f30abf1a942204b408c780eabbeac0859ba5a6db3459b55c47479583c57")
  10. add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
  11. add_configs("suitesparse", {description = "Enable SuiteSparse.", default = true, type = "boolean"})
  12. add_deps("cmake", "eigen", "glog", "gflags")
  13. on_load("windows", "linux", "macosx", function (package)
  14. if package:config("suitesparse") then
  15. package:add("deps", "suitesparse", {configs = {blas = package:config("blas")}})
  16. package:add("deps", "openmp")
  17. end
  18. end)
  19. on_install("windows|x64", "windows|x86", "linux", "macosx", function (package)
  20. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOCUMENTATION=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_BENCHMARKS=OFF", "-DCXSPARSE=OFF"}
  21. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  23. if package:is_plat("windows") then
  24. table.insert(configs, "-DMSVC_USE_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  25. end
  26. table.insert(configs, "-DSUITESPARSE=" .. (package:config("suitesparse") and "ON" or "OFF"))
  27. if package:config("suitesparse") then
  28. import("package.tools.cmake").install(package, configs, {packagedeps = {"openmp", "libomp"}})
  29. else
  30. import("package.tools.cmake").install(package, configs)
  31. end
  32. end)
  33. on_test(function (package)
  34. assert(package:has_cxxtypes("ceres::Problem", {configs = {languages = "c++17"}, includes = "ceres/ceres.h"}))
  35. end)