xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("cista")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://cista.rocks")
  4. set_description("Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.")
  5. set_license("MIT")
  6. add_urls("https://github.com/felixguendling/cista/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/felixguendling/cista.git")
  8. add_versions("v0.15", "f807d3282f68a74eed94d6e829763244ae22993169ab6ece7fd7c22bd2f08330")
  9. add_versions("v0.14", "9844a55fd3fd35a15614de01ff54e97ad0216d7b3d3952f14bfd6ebd7d6ff58f")
  10. add_deps("cmake")
  11. on_install("windows|x64", "windows|x86","linux", "macosx", "bsd", "android", "iphoneos", "cross", function (package)
  12. if package:is_plat("android") then
  13. import("core.tool.toolchain")
  14. local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
  15. local ndk_sdkver = ndk:config("ndk_sdkver")
  16. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(cista): need ndk api level > 21 for android")
  17. end
  18. import("package.tools.cmake").install(package, {"-DCISTA_INSTALL=ON"})
  19. end)
  20. on_test(function (package)
  21. assert(package:check_cxxsnippets({test = [[
  22. #include <vector>
  23. #include <cista/serialization.h>
  24. namespace data = cista::raw;
  25. struct my_struct {
  26. int a_{0};
  27. struct inner {
  28. data::string b_;
  29. } j;
  30. };
  31. void test() {
  32. std::vector<unsigned char> buf;
  33. {
  34. my_struct obj{1, {data::string{"test"}}};
  35. buf = cista::serialize(obj);
  36. }
  37. auto deserialized = cista::deserialize<my_struct>(buf);
  38. }
  39. ]]}, {configs = {languages = "c++17"}}))
  40. end)