xmake.lua 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package("mpich")
  2. set_homepage("https://www.mpich.org/")
  3. set_description("MPICH is a high performance and widely portable implementation of the Message Passing Interface (MPI) standard.")
  4. add_urls("http://www.mpich.org/static/downloads/$(version)/mpich-$(version).tar.gz")
  5. add_versions("3.4.2", "5c19bea8b84e8d74cca5f047e82b147ff3fba096144270e3911ad623d6c587bf")
  6. add_configs("device", {description = "Specify the communication device for MPICH.", default = "ofi", type = "string", values = {"ofi", "ucx"}})
  7. add_configs("x11", {description = "Use the X Window System.", default = false, type = "boolean"})
  8. if is_plat("linux") then
  9. add_extsources("apt::libmpich-dev")
  10. add_syslinks("pthread", "dl", "rt")
  11. end
  12. add_deps("hwloc")
  13. on_load("macosx", "linux", function (package)
  14. if package:config("x11") then
  15. package:add("deps", "libx11")
  16. package:add("deps", "libxnvctrl", {system = true, optional = true})
  17. end
  18. end)
  19. on_install("macosx", "linux", function (package)
  20. local configs = {"--disable-fortran",
  21. "--without-slurm",
  22. "--without-xpmem",
  23. "--without-hcoll",
  24. "--without-blcr",
  25. "--without-papi",
  26. "--without-pmix"}
  27. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  28. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  29. if package:config("pic") ~= false then
  30. table.insert(configs, "--with-pic")
  31. end
  32. table.insert(configs, "--with-device=ch4:" .. package:config("device"))
  33. table.insert(configs, "--with-hwloc-prefix=" .. package:dep("hwloc"):installdir())
  34. table.insert(configs, "--with-x=" .. (package:config("x11") and "yes" or "no"))
  35. import("package.tools.autoconf").install(package, configs)
  36. package:addenv("PATH", "bin")
  37. end)
  38. on_test(function (package)
  39. os.vrun("mpicc --version")
  40. assert(package:has_cfuncs("MPI_Init", {includes = "mpi.h"}))
  41. end)