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

concurrencpp: support some platform #4834

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions packages/c/concurrencpp/patches/0.1.7/add-include-string.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/include/concurrencpp/threads/thread.h b/include/concurrencpp/threads/thread.h
index 82ca58b..ecdaa27 100644
--- a/include/concurrencpp/threads/thread.h
+++ b/include/concurrencpp/threads/thread.h
@@ -4,6 +4,7 @@
#include "concurrencpp/platform_defs.h"

#include <functional>
+#include <string>
#include <string_view>
#include <thread>

23 changes: 19 additions & 4 deletions packages/c/concurrencpp/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,37 @@ package("concurrencpp")
add_versions("0.1.6", "e7d5c23a73ff1d7199d361d3402ad2a710dfccf7630b622346df94a7532b4221")
add_versions("0.1.7", "049f3e83ad1828e0b8b518652de1a3160d5849fdff03d521d0a5af0167338e89")

add_deps("cmake")
-- https://github.com/David-Haim/concurrencpp/issues/166
add_patches("0.1.7", "patches/0.1.7/add-include-string.patch", "a4b8c219fcc913a3cbeda1522c408f4b347e12f11ec130dd7df65504dcdccc09")

if is_plat("windows") then
add_syslinks("synchronization", "ws2_32", "mswsock")
elseif is_plat("linux", "bsd") then
add_syslinks("pthread")
end

add_deps("cmake")

on_check(function (package)
assert(package:check_cxxsnippets({test = [[
#include <semaphore>
#include <new>
void test() {
auto x = std::hardware_destructive_interference_size;
}
]]}, {configs = {languages = "c++20"}}), "package(concurrencpp) Require at least C++20.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不过这里似乎还是不太准,我 macos 上测试

8C454D9092B3AAD9C2C3C0B4.cpp:7:31: error: no member named 'hardware_destructive_interference_size
' in namespace 'std'
                auto x = std::hardware_destructive_interference_size;
                         ~~~~~^

但是去掉这个 最后安装编译 on_test 都能过。

end)

on_load(function (package)
package:add("includedirs", "include/concurrencpp-" .. package:version_str())
if package:is_plat("windows") and package:config("shared") then
package:add("defines", "CRCPP_IMPORT_API")
end
end)

on_install("macosx", "windows", function (package)
assert(package:has_tool("cxx", "clang", "cl"), "compiler not supported!")
on_install(function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
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"))
import("package.tools.cmake").install(package, configs)
end)
Expand Down
Loading