Browse Source

add celero (#625)

* add celero

* improve openblas
Hoildkv 4 years ago
parent
commit
7d6edbc088

+ 11 - 0
packages/c/celero/patches/2.8.2/gcc11.patch

@@ -0,0 +1,11 @@
+diff --git a/include/celero/TestFixture.h b/include/celero/TestFixture.h
+--- a/include/celero/TestFixture.h
++++ b/include/celero/TestFixture.h
+@@ -25,6 +25,7 @@
+ #include <cstddef>
+ #include <cstdint>
+ #include <limits>
++#include <memory>
+ #include <string>
+ #include <vector>
+ 

+ 36 - 0
packages/c/celero/xmake.lua

@@ -0,0 +1,36 @@
+package("celero")
+
+    set_homepage("https://github.com/DigitalInBlue/Celero")
+    set_description("C++ Benchmarking Library")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/DigitalInBlue/Celero/archive/refs/tags/$(version).zip",
+             "https://github.com/DigitalInBlue/Celero.git")
+    add_versions("v2.8.2", "6618c45adf2671c550997780e334592969fc4179d086b5b3cf5369fb1f4f6743")
+
+    add_patches("v2.8.2", path.join(os.scriptdir(), "patches", "2.8.2", "gcc11.patch"), "4851cc1ed85d9ee9ce000d7df9d5baabc86f83c50cff09074159239fa37ca8e9")
+
+    add_deps("cmake")
+    on_load("windows", function (package)
+        if not package:config("shared") then
+            package:add("defines", "CELERO_STATIC")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DCELERO_TREAT_WARNINGS_AS_ERRORS=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DCELERO_COMPILE_DYNAMIC_LIBRARIES=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DVCPKG_CRT_LINKAGE=" .. (package:config("vs_runtime"):startswith("MT") and "static" or "dynamic"))
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                const auto time = celero::timer::GetSystemTime();
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = "celero/Timer.h"}))
+    end)

+ 1 - 0
packages/o/openblas/xmake.lua

@@ -28,6 +28,7 @@ package("openblas")
     end
     end
 
 
     if is_plat("linux") then
     if is_plat("linux") then
+        add_extsources("apt::libopenblas-dev")
         add_syslinks("pthread")
         add_syslinks("pthread")
     elseif is_plat("macosx") then
     elseif is_plat("macosx") then
         add_frameworks("Accelerate")
         add_frameworks("Accelerate")