xmake.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. package("xpack")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/xyz347/xpack")
  4. set_description("convert json/xml/bson to c++ struct")
  5. set_license("Apache-2.0")
  6. add_urls("https://github.com/xyz347/xpack/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/xyz347/xpack.git")
  8. add_versions("v1.0.6", "76ccd82b0f0ddaae93d2340b2fa49e3245c2eb15c147f4736e27e8b05616085d")
  9. add_versions("v1.0.5", "ea8693dd3a53d54e0c1e3c9e6e06f31ff7f593f7f8cf8fb4889f5c3354dbae8e")
  10. add_deps("rapidjson", "rapidxml")
  11. on_install(function (package)
  12. os.cp("*.h", package:installdir("include", "xpack"))
  13. end)
  14. on_test(function (package)
  15. assert(package:check_cxxsnippets({test = [[
  16. #include <xpack/json.h>
  17. struct User {
  18. int id;
  19. std::string name;
  20. XPACK(O(id, name));
  21. };
  22. void test() {
  23. User u;
  24. std::string data = "{\"id\":12345, \"name\":\"xpack\"}";
  25. xpack::json::decode(data, u);
  26. }
  27. ]]}, {configs = {languages = "c++11"}}))
  28. end)