Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libunifex: add package #5485

Merged
merged 12 commits into from
Oct 14, 2024
13 changes: 13 additions & 0 deletions packages/l/libunifex/patches/v0.4.0/std-memset.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/source/win32/low_latency_iocp_context.cpp b/source/win32/low_latency_iocp_context.cpp
index 3941c87..db8c293 100644
--- a/source/win32/low_latency_iocp_context.cpp
+++ b/source/win32/low_latency_iocp_context.cpp
@@ -19,6 +19,7 @@
#include <unifex/scope_guard.hpp>
#include <unifex/exception.hpp>

+#include <cstring>
#include <atomic>
#include <random>
#include <system_error>

59 changes: 59 additions & 0 deletions packages/l/libunifex/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package("libunifex")
set_homepage("https://github.com/facebookexperimental/libunifex")
set_description("The 'libunifex' project is a prototype implementation of the C++ sender/receiver async programming model that is currently being considered for standardisation.")
set_license("Apache-2.0")

add_urls("https://github.com/facebookexperimental/libunifex/archive/refs/tags/$(version).tar.gz",
"https://github.com/facebookexperimental/libunifex.git")

add_versions("v0.4.0", "d5ce3b616e166da31e6b4284764a1feeba52aade868bcbffa94cfd86b402716e")

add_patches("v0.4.0", "patches/v0.4.0/std-memset.patch", "8108bf13b8071cff16e6d96bf97399ed3e657f59d6a843a078e42e4b3318def4")

if is_plat("linux", "bsd") then
add_syslinks("pthread")
end

add_deps("cmake")

if on_check then
on_check(function (package)
if package:is_plat("windows") then
local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
if vs_toolset then
local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
local minor = vs_toolset_ver:minor()
assert(minor and minor >= 30, "package(libunifex) require vs_toolset >= 14.3")
end
end
assert(package:has_cxxincludes("coroutine", {configs = {languages = "c++20"}}), "package(libunifex) require C++20 with coroutine support")
end)
end

on_install(function (package)
local configs = {"-DBUILD_TESTING=OFF", "-DUNIFEX_BUILD_EXAMPLES=OFF", "-DCMAKE_CXX_STANDARD=20"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
if package:config("shared") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
end
import("package.tools.cmake").install(package, configs)

if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.vcp(path.join(package:buildir(), "source/**.pdb"), dir)
end
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
using namespace unifex;
using namespace std::chrono;
auto delay(milliseconds ms) {
return schedule_after(current_scheduler, ms);
}
]]}, {configs = {languages = "c++20"}, includes = {"chrono", "unifex/on.hpp", "unifex/scheduler_concepts.hpp"}}))
end)
Loading