xmake.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. package("zeus_expected")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/zeus-cpp/expected")
  4. set_description("Backporting std::expected to C++17.")
  5. set_license("MIT")
  6. add_urls("https://github.com/zeus-cpp/expected/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/zeus-cpp/expected.git")
  8. add_versions("v1.1.1", "47b411677ffb2fa0d43b308797542509ae2bdb101426cf0d4777e3c162b1d726")
  9. add_versions("v1.1.0", "a963eba43f227498da2cbb924265344209696320c75ee63a92073936bb49f7e5")
  10. add_versions("v1.0.1", "e2a7dd56837fa1c30ce255c52361b6a245e732d265cfbd449d60826a8d0625ae")
  11. add_versions("v1.0.0", "a0d81798b777f9bfcc1e1e4f3046632067bd8c6071dbfcbec5012a31a5aebc68")
  12. add_patches("v1.0.0", path.join(os.scriptdir(), "patches", "v1.0.0", "fix_typename.patch"), "710d71f8c765a2937df25a2c52abec24f5f4ef5f43281f6aa01853d0498e2a47")
  13. on_install(function (package)
  14. os.cp("include", package:installdir())
  15. end)
  16. on_test(function (package)
  17. local cxflags = {}
  18. if package:is_plat("windows") then
  19. table.insert(cxflags, "/Zc:__cplusplus")
  20. end
  21. assert(package:check_cxxsnippets({test = [[
  22. #include <zeus/expected.hpp>
  23. void test() {
  24. zeus::expected<int, int> e1 = 42;
  25. zeus::expected<int, int> e2 = zeus::unexpected(42);
  26. }
  27. ]]}, {configs = {languages = "cxx17", cxflags = cxflags}}))
  28. end)