From 7d6edbc088e18bba8f413d9bee16d932b1f0153e Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Wed, 8 Sep 2021 06:32:03 +0800 Subject: [PATCH] add celero (#625) * add celero * improve openblas --- packages/c/celero/patches/2.8.2/gcc11.patch | 11 +++++++ packages/c/celero/xmake.lua | 36 +++++++++++++++++++++ packages/o/openblas/xmake.lua | 1 + 3 files changed, 48 insertions(+) create mode 100644 packages/c/celero/patches/2.8.2/gcc11.patch create mode 100644 packages/c/celero/xmake.lua diff --git a/packages/c/celero/patches/2.8.2/gcc11.patch b/packages/c/celero/patches/2.8.2/gcc11.patch new file mode 100644 index 000000000..099b5eb58 --- /dev/null +++ b/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 + #include + #include ++#include + #include + #include + diff --git a/packages/c/celero/xmake.lua b/packages/c/celero/xmake.lua new file mode 100644 index 000000000..c63757a00 --- /dev/null +++ b/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) diff --git a/packages/o/openblas/xmake.lua b/packages/o/openblas/xmake.lua index 0dae87fb4..c94f2d479 100644 --- a/packages/o/openblas/xmake.lua +++ b/packages/o/openblas/xmake.lua @@ -28,6 +28,7 @@ package("openblas") end if is_plat("linux") then + add_extsources("apt::libopenblas-dev") add_syslinks("pthread") elseif is_plat("macosx") then add_frameworks("Accelerate")