xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("libfiber")
  2. set_homepage("https://github.com/iqiyi/libfiber")
  3. set_description("The high performance coroutine library for Linux/FreeBSD/MacOS/Windows, supporting select/poll/epoll/kqueue/iocp/windows GUI")
  4. add_urls("https://github.com/iqiyi/libfiber/archive/refs/tags/$(version).tar.gz", {version = function (version)
  5. return version:gsub("%+", ".")
  6. end})
  7. add_urls("https://github.com/iqiyi/libfiber.git")
  8. add_versions("v0.9.0+0", "9359a7ebc8d9c48cfaa4c7d1445b3a3e1c392a238574f1d4f7c1191ec8242af2")
  9. add_deps("cmake")
  10. if is_plat("linux") then
  11. add_syslinks("pthread", "dl", "m")
  12. end
  13. on_install("linux", "macosx", "android", function (package)
  14. local configs = {"-Wno-dev"}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. io.writefile("CMakeLists.txt", [[
  18. cmake_minimum_required(VERSION 2.8)
  19. project(libfiber)
  20. add_subdirectory("c")
  21. add_subdirectory("cpp")]])
  22. io.replace("c/CMakeLists.txt", "-Werror", "", {plain = true})
  23. io.replace("cpp/CMakeLists.txt", "-Werror", "", {plain = true})
  24. import("package.tools.cmake").install(package, configs, {buildir = "build"})
  25. os.cp("c/include", package:installdir())
  26. os.cp("cpp/include/**.hpp", package:installdir("include/fiber"))
  27. os.cp("build/lib", package:installdir())
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("acl_fiber_create", {includes = "fiber/lib_fiber.h"}))
  31. end)