Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/t/toomanycooks/port/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
add_rules("mode.debug", "mode.release")

option("more_threads", {default = false, defines = "TMC_MORE_THREADS"})
option("priority_count", {default = "0"})
Comment thread
Akylzhan marked this conversation as resolved.
Outdated
option("hwloc", {default = false, defines = "TMC_USE_HWLOC"})

if has_config("hwloc") then
add_requires("hwloc")
end

target("toomanycooks")
set_kind("$(kind)")

add_includedirs("include", {public = true})
add_headerfiles("include/(**.hpp)")
add_files("lib.cpp")

add_options("more_threads", "hwloc")

if has_config("hwloc") then
add_packages("hwloc")
end

if has_config("priority_count") and get_config("priority_count") ~= 0 then
Comment thread
Akylzhan marked this conversation as resolved.
Outdated
add_defines("TMC_PRIORITY_COUNT=" .. get_config("priority_count"))
end
47 changes: 47 additions & 0 deletions packages/t/toomanycooks/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package("toomanycooks")
set_kind("library")
set_homepage("https://github.com/tzcnt/TooManyCooks/")
set_description("C++20 concurrency framework with no compromises. Excellent performance, powerful features, and simple syntax.")
set_license("BSL-1.0")

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

add_versions("v1.4.0", "5c847cfd73231409301732f3e158c52b694a2bd90d336e90f558811d59ef7f69")
Comment thread
Akylzhan marked this conversation as resolved.
Outdated

add_configs("priority_count", {default = 0, type = "number",
description = "Allows you to specify the number of priority levels at compile time. 0 = specified at runtime"})
add_configs("more_threads", {default = false, type = "boolean",
description = "Unlimited threads in cpu executor, otherwise fixed to 64 threads"})
add_configs("hwloc", {default = false, type = "boolean", description = "Build with hwloc"})

on_load(function (package)
if package:config("hwloc") then
package:add("deps", "hwloc")
end
end)

on_install(function (package)
io.writefile("lib.cpp", [[
#define TMC_IMPL
#include "tmc/all_headers.hpp" // IWYU pragma: keep
]])

os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")

import("package.tools.xmake").install(package, {
kind = package:config("shared") and "shared" or "static",
more_threads = package:config("more_threads"),
priority_count = package:config("priority_count"),
hwloc = package:config("hwloc")
})
end)

on_test(function (package)
assert(package:check_cxxsnippets({ test = [[
#include <tmc/all_headers.hpp>
int main(int argc, char **argv) {
return tmc::async_main([]() -> tmc::task<int> { co_return 0; }());
}
]]}, {configs = {languages = "c++20"}}))
end)
Loading