xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package("node_crunch2")
  2. set_homepage("https://github.com/willi-kappler/node_crunch2")
  3. set_description("A C++ library for distributed computing.")
  4. set_license("MIT")
  5. add_urls("https://github.com/willi-kappler/node_crunch2/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/willi-kappler/node_crunch2.git")
  7. add_versions("v0.1.0", "875fd1552abdf0262c89a45772cebae52c048014b107d64912beb8ab1bb78436")
  8. add_patches("v0.1.0", "patches/v0.1.0/nowarn.patch", "65028d054112b190649f832e57ab985e0971d198d98a64e8694493bdfc90c818")
  9. add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
  10. add_deps("spdlog", "asio", "lz4", "openssl", "taocpp-json")
  11. if on_check then
  12. on_check(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. #include <expected>
  15. void test() {
  16. std::expected<int, const char*> result = 42;
  17. if (result) {
  18. int value = *result;
  19. }
  20. }
  21. ]]}, {configs = {languages = "c++20"}}),
  22. "package(node_crunch2) requires a compiler supporting C++20 with <expected> header.")
  23. end)
  24. end
  25. on_install("!wasm", function (package)
  26. import("package.tools.xmake").install(package)
  27. end)
  28. on_test(function (package)
  29. local package_std = "c++20"
  30. if package:is_plat("windows") then
  31. package_std = "c++23"
  32. end
  33. assert(package:check_cxxsnippets({
  34. test = [[
  35. using namespace NodeCrunch2;
  36. void test() {
  37. NCNodeMessageType const message_type = NCNodeMessageType::Init;
  38. NCNodeID const node_id = NCNodeID();
  39. std::string const key1 = "12345678901234567890123456789012";
  40. NCMessageCodecNode node_codec(key1);
  41. NCMessageCodecServer server_codec(key1);
  42. NCConfiguration config = NCConfiguration(key1);
  43. }
  44. ]]
  45. }, {configs = {languages = package_std}, includes = {"nc_message.hpp", "nc_config.hpp"}}))
  46. end)