From 28eecb681952892a51f0c1520daba3c027f70d16 Mon Sep 17 00:00:00 2001 From: star9029 Date: Thu, 18 Jul 2024 23:13:19 +0800 Subject: [PATCH] dlpack: add package (#4687) --- packages/d/dlpack/xmake.lua | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/d/dlpack/xmake.lua diff --git a/packages/d/dlpack/xmake.lua b/packages/d/dlpack/xmake.lua new file mode 100644 index 000000000..8810ba26c --- /dev/null +++ b/packages/d/dlpack/xmake.lua @@ -0,0 +1,31 @@ +package("dlpack") + set_homepage("https://dmlc.github.io/dlpack/latest") + set_description("common in-memory tensor structure ") + set_license("Apache-2.0") + + add_urls("https://github.com/dmlc/dlpack/archive/refs/tags/$(version).tar.gz", + "https://github.com/dmlc/dlpack.git") + + add_versions("v0.8", "cf965c26a5430ba4cc53d61963f288edddcd77443aa4c85ce722aaf1e2f29513") + + add_configs("contrib", {description = "Build in progress unstable libraries", default = false, type = "boolean"}) + + add_deps("cmake") + + on_load(function (package) + if not package:config("contrib") then + package:set("kind", "library", {headeronly = true}) + end + end) + + on_install(function (package) + local configs = {} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DBUILD_MOCK=" .. (package:config("contrib") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_ctypes("DLDevice", {includes = "dlpack/dlpack.h"})) + end)