xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. package("visit_struct")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/cbeck88/visit_struct")
  4. set_description("A miniature library for struct-field reflection in C++")
  5. set_license("BSL-1.0")
  6. add_urls("https://github.com/cbeck88/visit_struct/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/garbageslam/visit_struct.git")
  8. add_versions('v1.1.0', '73a84f2d8a8844bc03a919163b27ee3b3f85d8c64f6151ce098ca50dbed6be51')
  9. on_install(function (package)
  10. os.cp("include", package:installdir())
  11. end)
  12. on_test(function (package)
  13. assert(package:check_cxxsnippets({test = [[
  14. struct debug_printer {
  15. template <typename T>
  16. void operator()(const char * name, const T & t) const {
  17. std::cout << " " << name << ": " << t << std::endl;
  18. }
  19. };
  20. struct test_struct_one {
  21. int a;
  22. float b;
  23. };
  24. VISITABLE_STRUCT(test_struct_one, a, b);
  25. void test() {
  26. test_struct_one my_struct{ 5, 7.5f };
  27. visit_struct::for_each(my_struct, debug_printer{});
  28. }
  29. ]]}, {configs = {languages = "c++11"}, includes = {"visit_struct/visit_struct.hpp", "iostream"}}))
  30. end)