xmake.lua 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_versions("1.2", "a59a2674ac2b0a3997b90873b2bf0fbe4d96fdedbe6a2628c16c92a65a3fa39a")
  9. add_configs("aio", {description = "default not open aio", default = false, type = "boolean"})
  10. add_configs("modules", {description = "default not use modules", default = false, type = "boolean"})
  11. add_deps("cmake")
  12. on_install("windows", "linux", "macosx", function (package)
  13. local configs = {"-DASYNC_SIMPLE_ENABLE_TESTS=OFF",
  14. "-DASYNC_SIMPLE_BUILD_DEMO_EXAMPLE=OFF"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DASYNC_SIMPLE_DISABLE_AIO=" .. (package:config("aio") and "OFF" or "ON"))
  17. table.insert(configs, "-DASYNC_SIMPLE_BUILD_MODULES=" .. (package:config("modules") and "ON" or "OFF"))
  18. import("package.tools.cmake").install(package, configs)
  19. if package:config("shared") then
  20. os.rm(package:installdir("lib/libasync_simple.a"))
  21. else
  22. os.rm(package:installdir("lib/*.so*"))
  23. end
  24. end)
  25. on_test(function (package)
  26. assert(package:check_cxxsnippets({test = [[
  27. #include <async_simple/coro/Lazy.h>
  28. async_simple::coro::Lazy<void> func() {
  29. co_return;
  30. }
  31. void test() {
  32. async_simple::coro::syncAwait(func());
  33. }
  34. ]]}, {configs = {languages = "c++20"}, includes = {"async_simple/coro/Lazy.h", "async_simple/coro/SyncAwait.h"}}))
  35. end)