xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("libfork")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://conorwilliams.github.io/libfork/")
  4. set_description("A bleeding-edge, lock-free, wait-free, continuation-stealing tasking library built on C++20's coroutines")
  5. set_license("MPL-2.0")
  6. add_urls("https://github.com/ConorWilliams/libfork/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/ConorWilliams/libfork.git")
  8. add_versions("v3.8.0", "53f23f0d27bb0753c0b03132f3c17bf8099617f037a2389a04e85fdd6f2736e8")
  9. if is_plat("linux", "bsd") then
  10. add_syslinks("pthread")
  11. end
  12. add_deps("cmake")
  13. if on_check then
  14. on_check("windows", function (package)
  15. import("core.tool.toolchain")
  16. local msvc = toolchain.load("msvc", {plat = package:plat(), arch = package:arch()})
  17. if msvc then
  18. local vs = msvc:config("vs")
  19. assert(vs and tonumber(vs) >= 2022, "package(libfork): need vs >= 2022")
  20. end
  21. end)
  22. end
  23. on_install(function (package)
  24. import("package.tools.cmake").install(package, {
  25. "-DCMAKE_INSTALL_INCLUDEDIR=" .. package:installdir("include")
  26. })
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. #include <libfork.hpp>
  31. void test() {
  32. lf::sync_wait(lf::lazy_pool{}, [](auto) -> lf::task<int>{ co_return 0; });
  33. }
  34. ]]}, {configs = {languages = "c++20"}}))
  35. end)