From 7ef599319a6f6c5b68a21070693057d3dc1ff4dc Mon Sep 17 00:00:00 2001 From: star9029 Date: Sun, 25 Aug 2024 00:13:53 +0800 Subject: [PATCH] libcbor: add package (#4972) * libcbor: add package * fix asan --- packages/l/libcbor/xmake.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 packages/l/libcbor/xmake.lua diff --git a/packages/l/libcbor/xmake.lua b/packages/l/libcbor/xmake.lua new file mode 100644 index 000000000..b04a77350 --- /dev/null +++ b/packages/l/libcbor/xmake.lua @@ -0,0 +1,23 @@ +package("libcbor") + set_homepage("https://github.com/PJK/libcbor") + set_description("CBOR protocol implementation for C") + set_license("MIT") + + add_urls("https://github.com/pjk/libcbor/archive/refs/tags/$(version).tar.gz", + "https://github.com/pjk/libcbor.git") + + add_versions("v0.11.0", "89e0a83d16993ce50651a7501355453f5250e8729dfc8d4a251a78ea23bb26d7") + + add_deps("cmake") + + on_install(function (package) + local configs = {"-DWITH_EXAMPLES=OFF", "-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=OFF"} + 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, "-DSANITIZE=" .. (package:config("asan") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("cbor_new_definite_map", {includes = "cbor.h"})) + end)