2
0

xmake.lua 1.1 KB

123456789101112131415161718192021222324
  1. package("cjson")
  2. set_homepage("https://github.com/DaveGamble/cJSON")
  3. set_description("Ultralightweight JSON parser in ANSI C.")
  4. set_license("MIT")
  5. set_urls("https://github.com/DaveGamble/cJSON/archive/v$(version).zip",
  6. "https://github.com/DaveGamble/cJSON.git")
  7. add_versions("1.7.10", "80a0584410656c8d8da2ba703744f44d7535fc4f0778d8bf4f980ce77c6a9f65")
  8. add_versions("1.7.14", "d797b4440c91a19fa9c721d1f8bab21078624aa9555fc64c5c82e24aa2a08221")
  9. add_versions("1.7.15", "c55519316d940757ef93a779f1db1ca809dbf979c551861f339d35aaea1c907c")
  10. add_deps("cmake")
  11. on_install("windows", "macosx", "linux", "iphoneos", "android", function (package)
  12. local configs = {"-DENABLE_CJSON_TEST=OFF"}
  13. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  14. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  15. import("package.tools.cmake").install(package, configs)
  16. end)
  17. on_test(function (package)
  18. assert(package:has_cfuncs("cJSON_malloc", {includes = "cjson/cJSON.h"}))
  19. end)