xmake.lua 1.6 KB

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