xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("rapidjson")
  2. set_kind("library", { headeronly = true })
  3. set_homepage("https://github.com/Tencent/rapidjson")
  4. set_description("RapidJSON is a JSON parser and generator for C++.")
  5. set_license("MIT")
  6. set_urls("https://github.com/Tencent/rapidjson/archive/$(version).zip",
  7. "https://github.com/Tencent/rapidjson.git")
  8. add_versions("2023.12.6", "6089180ecb704cb2b136777798fa1be303618975")
  9. add_versions("2022.7.20", "27c3a8dc0e2c9218fe94986d249a12b5ed838f1d")
  10. add_versions("v1.1.0", "8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab")
  11. -- This commit is used in arrow 7.0.0 https://github.com/apache/arrow/blob/release-7.0.0/cpp/thirdparty/versions.txt#L80
  12. add_versions("v1.1.0-arrow", "1a803826f1197b5e30703afe4b9c0e7dd48074f5")
  13. on_install(function (package)
  14. if package:is_plat("windows") and package:is_arch("arm.*") then
  15. package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN")
  16. end
  17. os.cp(path.join("include", "*"), package:installdir("include"))
  18. end)
  19. on_test(function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. void test()
  22. {
  23. const char* json = "{\"project\":\"rapidjson\",\"stars\":10}";
  24. rapidjson::Document d;
  25. d.Parse(json);
  26. rapidjson::StringBuffer buffer;
  27. rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
  28. d.Accept(writer);
  29. }
  30. ]]}, {configs = {languages = "c++11"}, includes = { "rapidjson/document.h", "rapidjson/stringbuffer.h", "rapidjson/writer.h"} }))
  31. end)