xmake.lua 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package("clblast")
  2. set_homepage("https://github.com/CNugteren/CLBlast")
  3. set_description("Tuned OpenCL BLAS ")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/CNugteren/CLBlast/archive/$(version).tar.gz",
  6. "https://github.com/CNugteren/CLBlast.git")
  7. add_versions("1.6.0", "9bff8219f753262e2c3bb38eb74264dce8772f626ed59d0765851a4269532888")
  8. add_configs("tuners", { description = "Enable compilation of the tuners", default = false, type = "boolean" })
  9. add_configs("workaround", { description = "Enables workaround for bug in AMD Southern Island GPUs", default = false, type = "boolean" })
  10. add_configs("verbose", { description = "Compile in verbose mode for additional diagnostic messages", default = false, type = "boolean" })
  11. add_configs("opencl", { description = "Build CLBlast with an OpenCL API", default = true, type = "boolean" })
  12. add_configs("cuda", { description = "Build CLBlast with a CUDA API (beta)", default = false, type = "boolean" })
  13. add_configs("netlib", { description = "Enable compilation of the CBLAS Netlib API", default = false, type = "boolean" })
  14. add_configs("netlib_persistent_opencl", { description = "Makes OpenCL device and context in the CBLAS Netlib API static", default = false, type = "boolean" })
  15. add_deps("cmake")
  16. if is_plat("linux") then
  17. add_extsources("apt::libclblast-dev")
  18. elseif is_plat("macosx") then
  19. add_extsources("brew::clblast")
  20. end
  21. on_load(function (package)
  22. if package:config("cuda") then
  23. package:add("deps", "cuda")
  24. end
  25. if package:config("opencl") then
  26. package:add("deps", "opencl")
  27. end
  28. end)
  29. on_install("windows|x86", "windows|x64", "linux", "macosx", function (package)
  30. local configs = {}
  31. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  32. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  33. table.insert(configs, "-DTUNERS=" .. (package:config("tuners") and "ON" or "OFF"))
  34. table.insert(configs, "-DVERBOSE=" .. (package:config("verbose") and "ON" or "OFF"))
  35. table.insert(configs, "-DAMD_SI_EMPTY_KERNEL_WORKAROUND=" .. (package:config("workaround") and "ON" or "OFF"))
  36. table.insert(configs, "-DOPENCL=" .. (package:config("opencl") and "ON" or "OFF"))
  37. table.insert(configs, "-DCUDA=" .. (package:config("cuda") and "ON" or "OFF"))
  38. table.insert(configs, "-DNETLIB=" .. (package:config("cuda") and "ON" or "OFF"))
  39. table.insert(configs, "-DNETLIB_PERSISTENT_OPENCL=" .. (package:config("cuda") and "ON" or "OFF"))
  40. if package:is_plat("windows") and package:config("vs_runtime"):startswith("MT") then
  41. table.insert(configs,"-DOVERRIDE_MSVC_FLAGS_TO_MT=ON")
  42. end
  43. import("package.tools.cmake").install(package, configs)
  44. end)
  45. on_test(function (package)
  46. assert(package:check_cxxsnippets({test = [[
  47. #include <clblast.h>
  48. void test () {
  49. clblast::ClearCache();
  50. }
  51. ]]}, {configs = {languages = "c++11"}}))
  52. assert(package:check_csnippets({test = [[
  53. #include <clblast_c.h>
  54. void test () {
  55. CLBlastClearCache();
  56. }
  57. ]]}, {configs = {languages = "c11"}}))
  58. end)