xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("yyjson")
  2. set_homepage("https://github.com/ibireme/yyjson")
  3. set_description("The fastest JSON library in C.")
  4. add_urls("https://github.com/ibireme/yyjson/archive/$(version).tar.gz",
  5. "https://github.com/ibireme/yyjson.git")
  6. add_versions("0.8.0", "b2e39ac4c65f9050820c6779e6f7dd3c0d3fed9c6667f91caec0badbedce00f3")
  7. add_versions("0.5.1", "b484d40b4e20cc3174a6fdc160d0f20f961417f9cb3f6dc1cf6555fffa8359f3")
  8. add_versions("0.5.0", "1a65c41d25394c979ad26554a0befb8006ecbf9f7f3a5b0130fdae4f2dd03d42")
  9. add_versions("0.4.0", "061fe713391d7f3f85f13e8bb2752a4cdeb8e70ce20d68e1e9e4332bd0bf64fa")
  10. add_versions("0.3.0", "f5ad3e3be40f0307a732c2b8aff9a1ba6014a6b346f3ec0b128459607748e990")
  11. add_versions("0.2.0", "43aacdc6bc3876dc1322200c74031b56d8d7838c04e46ca8a8e52e37ea6128da")
  12. on_install(function (package)
  13. io.writefile("xmake.lua", [[
  14. add_rules("mode.debug", "mode.release")
  15. target("yyjson")
  16. set_kind("$(kind)")
  17. add_files("src/*.c")
  18. add_headerfiles("src/*.h")
  19. if is_kind("shared") and is_plat("windows") then
  20. add_defines("YYJSON_EXPORTS")
  21. end
  22. ]])
  23. local configs = {}
  24. if package:config("shared") then
  25. configs.kind = "shared"
  26. end
  27. import("package.tools.xmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("yyjson_read", {includes = "yyjson.h"}))
  31. end)