xmake.lua 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("suitesparse")
  2. set_homepage("https://people.engr.tamu.edu/davis/suitesparse.html")
  3. set_description("SuiteSparse is a suite of sparse matrix algorithms")
  4. add_urls("https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/DrTimothyAldenDavis/SuiteSparse.git")
  6. add_versions("v5.10.1", "acb4d1045f48a237e70294b950153e48dce5b5f9ca8190e86c2b8c54ce00a7ee")
  7. add_versions("v5.12.0", "5fb0064a3398111976f30c5908a8c0b40df44c6dd8f0cc4bfa7b9e45d8c647de")
  8. add_patches("5.x", path.join(os.scriptdir(), "patches", "5.10.1", "msvc.patch"), "8ac61e9acfaa864a2528a14d3a7e6e86f6e6877de2fe93fdc87876737af5bf31")
  9. add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
  10. add_configs("blas", {description = "Set BLAS vendor.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
  11. add_configs("graphblas", {description = "Enable GraphBLAS module.", default = false, type = "boolean"})
  12. add_deps("metis")
  13. if is_plat("linux") then
  14. add_syslinks("m", "rt")
  15. end
  16. on_load("windows", "macosx", "linux", function (package)
  17. if package:config("cuda") then
  18. package:add("deps", "cuda", {system = true, configs = {utils = {"cublas"}}})
  19. package:add("links", "GPUQREngine")
  20. package:add("links", "SuiteSparse_GPURuntime")
  21. end
  22. if package:config("graphblas") then
  23. package:add("links", "GraphBLAS")
  24. end
  25. package:add("deps", package:config("blas"))
  26. for _, lib in ipairs({"SPQR", "UMFPACK", "LDL", "KLU", "CXSparse", "CHOLMOD", "COLAMD", "CCOLAMD", "CAMD", "BTF", "AMD", "suitesparseconfig"}) do
  27. package:add("links", lib)
  28. end
  29. end)
  30. on_install("windows", "macosx", "linux", function (package)
  31. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  32. local configs = {}
  33. configs.with_blas = package:config("blas")
  34. configs.with_cuda = package:config("cuda")
  35. configs.graphblas = package:config("graphblas")
  36. import("package.tools.xmake").install(package, configs)
  37. end)
  38. on_test(function (package)
  39. assert(package:has_cfuncs("SuiteSparse_start", {includes = "SuiteSparse_config.h"}))
  40. end)