xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334
  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. add_urls("http://ceres-solver.org/ceres-solver-$(version).tar.gz")
  5. add_versions("2.0.0", "10298a1d75ca884aa0507d1abb0e0f04800a92871cd400d4c361b56a777a7603")
  6. add_versions("2.1.0", "f7d74eecde0aed75bfc51ec48c91d01fe16a6bf16bce1987a7073286701e2fc6")
  7. add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
  8. add_configs("suitesparse", {description = "Enable SuiteSparse.", default = true, type = "boolean"})
  9. add_deps("cmake", "eigen", "glog", "gflags")
  10. on_load("windows", "linux", "macosx", function (package)
  11. if package:config("suitesparse") then
  12. package:add("deps", "suitesparse", {configs = {blas = package:config("blas")}})
  13. end
  14. end)
  15. on_install("windows", "linux", "macosx", function (package)
  16. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOCUMENTATION=OFF", "-DBUILD_EXAMPLES=OFF", "-DBUILD_BENCHMARKS=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. if package:is_plat("windows") then
  20. table.insert(configs, "-DMSVC_USE_STATIC_CRT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  21. end
  22. table.insert(configs, "-DSUITESPARSE=" .. (package:config("suitesparse") and "ON" or "OFF"))
  23. table.insert(configs, "-DCXSPARSE=" .. (package:config("suitesparse") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cxxtypes("ceres::Problem", {configs = {languages = "c++14"}, includes = "ceres/ceres.h"}))
  28. end)