Browse Source

add check

star9029 1 year ago
parent
commit
aae00bf83d

+ 12 - 0
packages/c/concurrencpp/patches/0.1.7/add-include-string.patch

@@ -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>
+

+ 13 - 1
packages/c/concurrencpp/xmake.lua

@@ -11,7 +11,7 @@ package("concurrencpp")
     add_versions("0.1.6", "e7d5c23a73ff1d7199d361d3402ad2a710dfccf7630b622346df94a7532b4221")
     add_versions("0.1.7", "049f3e83ad1828e0b8b518652de1a3160d5849fdff03d521d0a5af0167338e89")
 
-    add_deps("cmake")
+    add_patches("0.1.7", "patches/0.1.7/add-include-string.patch", "ac0a1cbe43162beab4e29009fde658a765a00ad0817a010f1f208e0c5bd67b75")
 
     if is_plat("windows") then
         add_syslinks("synchronization", "ws2_32", "mswsock")
@@ -19,6 +19,18 @@ package("concurrencpp")
         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.")
+    end)
+
     on_load(function (package)
         package:add("includedirs", "include/concurrencpp-" .. package:version_str())
         if package:is_plat("windows") and package:config("shared") then