xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("toml++")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://marzer.github.io/tomlplusplus/")
  4. set_description("toml++ is a header-only TOML config file parser and serializer for C++17 (and later!).")
  5. add_urls("https://github.com/marzer/tomlplusplus/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/marzer/tomlplusplus.git")
  7. add_versions("v2.5.0", "2e246ee126cfb7bd68edd7285d5bb5c8c5296121ce809306ee71cfd6127c76a6")
  8. add_versions("v3.0.0", "934ad62e82ae5ee67bdef512b39d24ddba45e012fb94e22b39fa1fb192bdabab")
  9. add_versions("v3.1.0", "3d491511b3fb4004e0f42b781ed2cb843769a14ad4642f2c00250f7440265eb2")
  10. add_deps("cmake")
  11. on_install(function (package)
  12. import("package.tools.cmake").install(package)
  13. end)
  14. on_test(function (package)
  15. assert(package:check_cxxsnippets({test = [[
  16. #include <iostream>
  17. #include <sstream>
  18. #include <toml++/toml.h>
  19. using namespace std::string_view_literals;
  20. static void test() {
  21. static constexpr std::string_view some_toml = R"(
  22. [library]
  23. name = "toml++"
  24. authors = ["Mark Gillard <[email protected]>"]
  25. cpp = 17
  26. )"sv;
  27. toml::table tbl = toml::parse(some_toml);
  28. std::cout << tbl << "\n";
  29. }
  30. ]]}, {configs = {languages = "c++17"}, includes = "toml++/toml.h"}))
  31. end)