Ver Fonte

add libfiber (#841)

* add libfiber

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua
ruki há 3 anos atrás
pai
commit
d6e6d19413
1 ficheiros alterados com 35 adições e 0 exclusões
  1. 35 0
      packages/l/libfiber/xmake.lua

+ 35 - 0
packages/l/libfiber/xmake.lua

@@ -0,0 +1,35 @@
+package("libfiber")
+    set_homepage("https://github.com/iqiyi/libfiber")
+    set_description("The high performance coroutine library for Linux/FreeBSD/MacOS/Windows, supporting select/poll/epoll/kqueue/iocp/windows GUI")
+
+    add_urls("https://github.com/iqiyi/libfiber/archive/refs/tags/$(version).tar.gz", {version = function (version)
+        return version:gsub("%+", ".")
+    end})
+    add_urls("https://github.com/iqiyi/libfiber.git")
+    add_versions("v0.9.0+0", "9359a7ebc8d9c48cfaa4c7d1445b3a3e1c392a238574f1d4f7c1191ec8242af2")
+
+    add_deps("cmake")
+    if is_plat("linux") then
+        add_syslinks("pthread", "dl", "m")
+    end
+
+    on_install("linux", "macosx", "android", function (package)
+        local configs = {"-Wno-dev"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        io.writefile("CMakeLists.txt", [[
+        cmake_minimum_required(VERSION 2.8)
+        project(libfiber)
+        add_subdirectory("c")
+        add_subdirectory("cpp")]])
+        io.replace("c/CMakeLists.txt", "-Werror", "", {plain = true})
+        io.replace("cpp/CMakeLists.txt", "-Werror", "", {plain = true})
+        import("package.tools.cmake").install(package, configs, {buildir = "build"})
+        os.cp("c/include", package:installdir())
+        os.cp("cpp/include/**.hpp", package:installdir("include/fiber"))
+        os.cp("build/lib", package:installdir())
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("acl_fiber_create", {includes = "fiber/lib_fiber.h"}))
+    end)