xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.14", "9844a55fd3fd35a15614de01ff54e97ad0216d7b3d3952f14bfd6ebd7d6ff58f")
  9. add_deps("cmake")
  10. on_install("windows|x64", "windows|x86","linux", "macosx", "bsd", "android", "iphoneos", "cross", function (package)
  11. if package:is_plat("android") then
  12. import("core.tool.toolchain")
  13. local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
  14. local ndk_sdkver = ndk:config("ndk_sdkver")
  15. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(cista): need ndk api level > 21 for android")
  16. end
  17. import("package.tools.cmake").install(package, {"-DCISTA_INSTALL=ON"})
  18. end)
  19. on_test(function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. #include <vector>
  22. #include <cista/serialization.h>
  23. namespace data = cista::raw;
  24. struct my_struct {
  25. int a_{0};
  26. struct inner {
  27. data::string b_;
  28. } j;
  29. };
  30. void test() {
  31. std::vector<unsigned char> buf;
  32. {
  33. my_struct obj{1, {data::string{"test"}}};
  34. buf = cista::serialize(obj);
  35. }
  36. auto deserialized = cista::deserialize<my_struct>(buf);
  37. }
  38. ]]}, {configs = {languages = "c++17"}}))
  39. end)