xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("async_simple")
  2. set_homepage("https://github.com/alibaba/async_simple")
  3. set_description("Simple, light-weight and easy-to-use asynchronous components")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/alibaba/async_simple/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/alibaba/async_simple.git")
  7. add_versions("1.1", "32d1ea16dfc1741206b6e4a3fbe532eeb1c378619766c1abe11a9efc53109c10")
  8. add_configs("aio", {description = "default not open aio", default = false, type = "boolean"})
  9. add_configs("modules", {description = "default not use modules", default = false, type = "boolean"})
  10. add_deps("cmake")
  11. on_install("windows", "linux", "macosx", function (package)
  12. local configs = {"-DASYNC_SIMPLE_ENABLE_TESTS=OFF",
  13. "-DASYNC_SIMPLE_BUILD_DEMO_EXAMPLE=OFF"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DASYNC_SIMPLE_DISABLE_AIO=" .. (package:config("aio") and "OFF" or "ON"))
  16. table.insert(configs, "-DASYNC_SIMPLE_BUILD_MODULES=" .. (package:config("modules") and "ON" or "OFF"))
  17. import("package.tools.cmake").install(package, configs)
  18. if package:config("shared") then
  19. os.rm(package:installdir("lib/libasync_simple.a"))
  20. else
  21. os.rm(package:installdir("lib/libasync_simple.so"))
  22. end
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. #include <async_simple/coro/Lazy.h>
  27. async_simple::coro::Lazy<void> func() {
  28. co_return;
  29. }
  30. void test() {
  31. async_simple::coro::syncAwait(func());
  32. }
  33. ]]}, {configs = {languages = "c++20"}, includes = {"async_simple/coro/Lazy.h", "async_simple/coro/SyncAwait.h"}}))
  34. end)