xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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(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. package:addenv("PATH", "bin")
  19. end)
  20. on_install("macosx", "linux", function (package)
  21. local configs = {
  22. "--disable-dependency-tracking",
  23. "--disable-fortran",
  24. "--without-slurm",
  25. "--without-xpmem",
  26. "--without-hcoll",
  27. "--without-blcr",
  28. "--without-papi",
  29. "--without-pmix"
  30. }
  31. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  32. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  33. table.insert(configs, "--with-device=ch4:" .. package:config("device"))
  34. table.insert(configs, "--with-hwloc-prefix=" .. package:dep("hwloc"):installdir())
  35. table.insert(configs, "--with-x=" .. (package:config("x11") and "yes" or "no"))
  36. local opt = {}
  37. if package:is_plat("linux") then
  38. opt.ldflags = "-lm"
  39. opt.shflags = "-lm"
  40. end
  41. import("package.tools.autoconf").install(package, configs, opt)
  42. end)
  43. on_test(function (package)
  44. if not package:is_cross() then
  45. os.vrun("mpicc --version")
  46. end
  47. assert(package:has_cfuncs("MPI_Init", {includes = "mpi.h"}))
  48. end)