xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233
  1. package("hypre")
  2. set_homepage("https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods")
  3. set_description("Parallel solvers for sparse linear systems featuring multigrid methods.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/hypre-space/hypre/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/hypre-space/hypre.git")
  7. add_versions("v2.30.0", "8e2af97d9a25bf44801c6427779f823ebc6f306438066bba7fcbc2a5f9b78421")
  8. add_versions("v2.20.0", "5be77b28ddf945c92cde4b52a272d16fb5e9a7dc05e714fc5765948cba802c01")
  9. add_versions("v2.23.0", "8a9f9fb6f65531b77e4c319bf35bfc9d34bf529c36afe08837f56b635ac052e2")
  10. add_configs("blas", {description = "Choose BLAS library to use.", default = "openblas", type = "string", values = {"mkl", "openblas"}})
  11. if is_plat("windows") then
  12. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  13. end
  14. add_deps("cmake")
  15. on_load("windows", "macosx", "linux", function (package)
  16. package:add("deps", package:config("blas"))
  17. end)
  18. on_install("windows|x86", "windows|x64", "linux", "macosx", function (package)
  19. os.cd("src")
  20. local configs = {"-DHYPRE_WITH_MPI=OFF", "-DHYPRE_BUILD_EXAMPLES=OFF", "-DHYPRE_BUILD_TESTS=OFF", "-DHYPRE_USING_HYPRE_BLAS=OFF", "-DHYPRE_USING_HYPRE_LAPACK=OFF"}
  21. table.insert(configs, "-DHYPRE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  22. table.insert(configs, "-DHYPRE_ENABLE_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:has_cfuncs(package:version():ge("v2.29.0") and "HYPRE_Initialize" or "HYPRE_Init", {includes = "HYPRE_utilities.h"}))
  27. end)