Przeglądaj źródła

add gperftools (#1464)

* update benchmark

* add gperftools

* fix benchmark
Hoildkv 3 lat temu
rodzic
commit
35ed715668
2 zmienionych plików z 29 dodań i 1 usunięć
  1. 7 1
      packages/b/benchmark/xmake.lua
  2. 22 0
      packages/g/gperftools/xmake.lua

+ 7 - 1
packages/b/benchmark/xmake.lua

@@ -2,6 +2,7 @@ package("benchmark")
 
     set_homepage("https://github.com/google/benchmark")
     set_description("A microbenchmark support library")
+    set_license("Apache-2.0")
 
     add_urls("https://github.com/google/benchmark/archive/v$(version).tar.gz",
              "https://github.com/google/benchmark.git")
@@ -12,6 +13,7 @@ package("benchmark")
     add_versions("1.5.6", "789f85b4810d13ff803834ea75999e41b326405d83d6a538baf01499eda96102")
     add_versions("1.6.0", "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6")
     add_versions("1.6.1", "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4")
+    add_versions("1.7.0", "3aff99169fa8bdee356eaa1f691e835a6e57b1efeadb8a0f9f228531158246ac")
 
     if is_plat("mingw") and is_subhost("msys") then
         add_extsources("pacman::benchmark")
@@ -28,8 +30,12 @@ package("benchmark")
     end
 
     add_deps("cmake")
-
     add_links("benchmark_main", "benchmark")
+    on_load("windows", function (package)
+        if not package:config("shared") then
+            package:add("defines", "BENCHMARK_STATIC_DEFINE")
+        end
+    end)
 
     on_install("macosx", "linux", "windows", function (package)
         local configs = {"-DBENCHMARK_ENABLE_TESTING=OFF"}

+ 22 - 0
packages/g/gperftools/xmake.lua

@@ -0,0 +1,22 @@
+package("gperftools")
+
+    set_homepage("https://github.com/gperftools/gperftools")
+    set_description("gperftools is a collection of a high-performance multi-threaded malloc() implementation, plus some pretty nifty performance analysis tools.")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/gperftools/gperftools/archive/refs/tags/gperftools-$(version).tar.gz")
+    add_versions("2.10", "b0dcfe3aca1a8355955f4b415ede43530e3bb91953b6ffdd75c45891070fe0f1")
+
+    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
+
+    add_deps("cmake")
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DBUILD_TESTING=OFF", "-Dgperftools_build_benchmark=OFF"}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DGPERFTOOLS_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("tc_version", {includes = "gperftools/tcmalloc.h"}))
+    end)