xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. package("dlpack")
  2. set_homepage("https://dmlc.github.io/dlpack/latest")
  3. set_description("common in-memory tensor structure ")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/dmlc/dlpack/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/dmlc/dlpack.git")
  7. add_versions("v1.0", "f8cfdcb634ff3cf0e3d9a3426e019e1c6469780a3b0020c9bc4ecc09cf9abcb1")
  8. add_versions("v0.8", "cf965c26a5430ba4cc53d61963f288edddcd77443aa4c85ce722aaf1e2f29513")
  9. add_configs("contrib", {description = "Build in progress unstable libraries", default = false, type = "boolean"})
  10. add_deps("cmake")
  11. on_load(function (package)
  12. if not package:config("contrib") then
  13. package:set("kind", "library", {headeronly = true})
  14. end
  15. end)
  16. on_install(function (package)
  17. local configs = {}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  20. table.insert(configs, "-DBUILD_MOCK=" .. (package:config("contrib") and "ON" or "OFF"))
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:has_ctypes("DLDevice", {includes = "dlpack/dlpack.h"}))
  25. end)