xmake.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. package("libmill")
  2. set_homepage("http://libmill.org")
  3. set_description("Go-style concurrency in C")
  4. set_urls("https://github.com/sustrik/libmill.git")
  5. add_versions("2021.9.9", "e8937e624757663f5379018cae3f2b3e916afb6c")
  6. add_deps("cmake")
  7. on_install("macosx", "linux", function (package)
  8. local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_PERF=OFF"}
  9. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  10. import("package.tools.cmake").install(package, configs)
  11. if package:config("shared") then
  12. os.tryrm(path.join(package:installdir("lib"), "*.a"))
  13. else
  14. os.tryrm(path.join(package:installdir("lib"), "*.so"))
  15. end
  16. end)
  17. on_test(function (package)
  18. assert(package:check_csnippets({test = [[
  19. #include "libmill.h"
  20. static coroutine void switchtask(size_t count) {
  21. yield();
  22. }
  23. void test() {
  24. go(switchtask(0));
  25. }
  26. ]]}))
  27. end)