xmake.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. package("microsoft-gsl")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/microsoft/GSL")
  4. set_description("Guidelines Support Library")
  5. set_license("MIT")
  6. add_urls("https://github.com/microsoft/GSL/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/microsoft/GSL.git")
  8. add_versions("v4.1.0", "0a227fc9c8e0bf25115f401b9a46c2a68cd28f299d24ab195284eb3f1d7794bd")
  9. add_versions("v4.0.0", "f0e32cb10654fea91ad56bde89170d78cfbf4363ee0b01d8f097de2ba49f6ce9")
  10. add_versions("v3.1.0", "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083")
  11. add_deps("cmake")
  12. on_install(function (package)
  13. local configs = {"-DGSL_TEST=OFF", "-DGSL_INSTALL=ON"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  15. import("package.tools.cmake").install(package, configs)
  16. end)
  17. on_test(function (package)
  18. assert(package:check_cxxsnippets({test = [[
  19. #include <vector>
  20. #include <type_traits>
  21. void test() {
  22. std::vector<int> v{1,2,3,4};
  23. gsl::span sp{v};
  24. static_assert(std::is_same<decltype(sp), gsl::span<int>>::value);
  25. }
  26. ]]}, {configs = {languages = "c++17"}, includes = "gsl/span"}))
  27. end)