xmake.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("msgpack23")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/rwindegger/msgpack23")
  4. set_description("A modern, header-only C++ library for MessagePack serialization and deserialization. msgpack.org[c++23]")
  5. set_license("MIT")
  6. add_urls("https://github.com/rwindegger/msgpack23/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/rwindegger/msgpack23.git")
  8. add_versions("v3.0", "706cb1a623b9fb178f1a14c00322b147165b57e557df9777a5825ff32052eb5f")
  9. add_versions("v2.1", "9ce1e294518aa76cac50f778a359aed17a0daa0d8dc4c1f94cd4f12438b3606c")
  10. add_deps("cmake")
  11. on_check(function (package)
  12. assert(package:check_cxxsnippets({test = [[
  13. #include <utility>
  14. enum class Color : char {
  15. red
  16. };
  17. void test() {
  18. std::to_underlying(Color::red);
  19. }
  20. ]]}, {configs = {languages = "c++23"}}), "package(msgpack23) require c++23")
  21. end)
  22. on_install(function (package)
  23. local configs = {"-DBUILD_TESTING=OFF"}
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  25. import("package.tools.cmake").install(package, configs)
  26. io.replace(path.join(package:installdir("include/msgpack23"), "msgpack23.h"),
  27. "#include <cstring>", "#include <cstring>\n#include <utility>", {plain = true})
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. void test() {
  32. msgpack23::Packer packer;
  33. }
  34. ]]}, {configs = {languages = "c++23"}, includes = "msgpack23/msgpack23.h"}))
  35. end)