From dfb09c6d87e7ee170f20dcb6eca3b272a1a31765 Mon Sep 17 00:00:00 2001 From: dco <50023189+Carryme1899@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:12:54 +0800 Subject: [PATCH] cJSON: update to v1.7.18 (#5614) * cJSON: update to v1.7.18 * Update xmake.lua --------- Co-authored-by: star9029 --- packages/c/cjson/xmake.lua | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/c/cjson/xmake.lua b/packages/c/cjson/xmake.lua index 3ab41307b..a20ac5450 100644 --- a/packages/c/cjson/xmake.lua +++ b/packages/c/cjson/xmake.lua @@ -1,22 +1,36 @@ package("cjson") - set_homepage("https://github.com/DaveGamble/cJSON") set_description("Ultralightweight JSON parser in ANSI C.") set_license("MIT") - set_urls("https://github.com/DaveGamble/cJSON/archive/v$(version).zip", + set_urls("https://github.com/DaveGamble/cJSON/archive/refs/tags/$(version).tar.gz", "https://github.com/DaveGamble/cJSON.git") - add_versions("1.7.10", "80a0584410656c8d8da2ba703744f44d7535fc4f0778d8bf4f980ce77c6a9f65") - add_versions("1.7.14", "d797b4440c91a19fa9c721d1f8bab21078624aa9555fc64c5c82e24aa2a08221") - add_versions("1.7.15", "c55519316d940757ef93a779f1db1ca809dbf979c551861f339d35aaea1c907c") + + add_versions("v1.7.18", "3aa806844a03442c00769b83e99970be70fbef03735ff898f4811dd03b9f5ee5") + add_versions("v1.7.15", "5308fd4bd90cef7aa060558514de6a1a4a0819974a26e6ed13973c5f624c24b2") add_deps("cmake") - on_install("windows", "macosx", "linux", "iphoneos", "android", function (package) - local configs = {"-DENABLE_CJSON_TEST=OFF"} - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + on_install(function (package) + if package:is_plat("windows") then + if package:config("shared") then + package:add("defines", "CJSON_IMPORT_SYMBOLS") + else + package:add("defines", "CJSON_HIDE_SYMBOLS") + end + end + + io.replace("CMakeLists.txt", "-Werror", "", {plain = true}) + + local configs = {"-DENABLE_CJSON_TEST=OFF", "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"} + 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")) import("package.tools.cmake").install(package, configs) + + if package:is_plat("windows") and package:is_debug() then + local dir = package:installdir(package:config("shared") and "bin" or "lib") + os.trycp(path.join(package:buildir(), "cjson.pdb"), dir) + end end) on_test(function (package)