xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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("v2.1", "9ce1e294518aa76cac50f778a359aed17a0daa0d8dc4c1f94cd4f12438b3606c")
  9. add_deps("cmake")
  10. on_check(function (package)
  11. assert(package:check_cxxsnippets({test = [[
  12. #include <utility>
  13. enum class Color : char {
  14. red
  15. };
  16. void test() {
  17. std::to_underlying(Color::red);
  18. }
  19. ]]}, {configs = {languages = "c++23"}}), "package(msgpack23) require c++23")
  20. end)
  21. on_install(function (package)
  22. local configs = {"-DBUILD_TESTING=OFF"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. import("package.tools.cmake").install(package, configs)
  25. io.replace(path.join(package:installdir("include/msgpack23"), "msgpack23.h"),
  26. "#include <cstring>", "#include <cstring>\n#include <utility>", {plain = true})
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. void test() {
  31. msgpack23::Packer packer;
  32. }
  33. ]]}, {configs = {languages = "c++23"}, includes = "msgpack23/msgpack23.h"}))
  34. end)