xmake.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("boost_reflect")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/boost-ext/reflect")
  4. set_description("C++20 static reflection library")
  5. add_urls("https://github.com/boost-ext/reflect/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/boost-ext/reflect.git")
  7. add_versions("v1.2.4", "8844faf7e282d9b9841fdee89b3ccfa80a800d7c35b6575c5f64cfa5946e0854")
  8. add_versions("v1.2.3", "583fe281c3b83f403b7fb18389e64bacc3ca0b30683d550f2ad6159cc0ebb6be")
  9. add_versions("v1.1.1", "49b20cbc0e5d9f94bcdc96056f8c5d91ee2e45d8642e02cb37e511079671ad48")
  10. if on_check then
  11. on_check("windows", function (package)
  12. import("core.base.semver")
  13. local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
  14. assert(vs_toolset and semver.new(vs_toolset):minor() >= 30, "package(boost_reflect) require vs_toolset >= v143")
  15. end)
  16. end
  17. on_install("windows", "mingw", "linux", function (package)
  18. os.cp("reflect", package:installdir("include"))
  19. end)
  20. on_test(function (package)
  21. assert(package:check_cxxsnippets({test = [[
  22. #include <reflect>
  23. enum E { A, B };
  24. struct foo { int a; E b; };
  25. void test() {
  26. constexpr auto f = foo{.a = 42, .b = B};
  27. static_assert(2 == reflect::size(f));
  28. }
  29. ]]}, {configs = {languages = "c++20"}}))
  30. end)