From c816943bbb54fd0c59310a00682ac3e10a4519c4 Mon Sep 17 00:00:00 2001 From: star9029 Date: Thu, 12 Oct 2023 09:05:34 +0800 Subject: [PATCH] daw_json_link: add package (#2702) * daw_json_link: add package * disable plat --- packages/d/daw_json_link/xmake.lua | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/d/daw_json_link/xmake.lua diff --git a/packages/d/daw_json_link/xmake.lua b/packages/d/daw_json_link/xmake.lua new file mode 100644 index 00000000000..ccbc5d9b125 --- /dev/null +++ b/packages/d/daw_json_link/xmake.lua @@ -0,0 +1,33 @@ +package("daw_json_link") + set_kind("library", {headeronly = true}) + set_homepage("https://beached.github.io/daw_json_link/") + set_description("Fast, convenient JSON serialization and parsing in C++") + set_license("BSL-1.0") + + add_urls("https://github.com/beached/daw_json_link/archive/refs/tags/$(version).tar.gz", + "https://github.com/beached/daw_json_link.git") + + add_versions("v3.20.1", "046638bc4437d138cc8bdc882027d318ca3e267f33d1b419c5bdecb45b595a47") + + add_deps("cmake") + + on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", "cross", function (package) + if package:is_plat("android") then + import("core.tool.toolchain") + local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()}) + local ndk_sdkver = ndk:config("ndk_sdkver") + assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(daw_json_link): need ndk api level > 21 for android") + end + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + void test() { + std::string json_data = "[1, 2, 3, 4, 5]"; + auto const obj = daw::json::from_json_array(json_data); + } + ]]}, {configs = {languages = "c++17"}})) + end)