Browse Source

benchmark: add mingw platform (#4085)

* fix mingw

* update xmake

* fix xmake
Linpeng Zhang 1 year ago
parent
commit
b6028befa9
1 changed files with 7 additions and 3 deletions
  1. 7 3
      packages/b/benchmark/xmake.lua

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

@@ -28,10 +28,14 @@ package("benchmark")
 
     if is_plat("linux") then
         add_syslinks("pthread")
-    elseif is_plat("windows") then
+    elseif is_plat("windows", "mingw") then
         add_syslinks("shlwapi")
     end
 
+    if is_plat("mingw") then
+        add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
+    end
+
     add_deps("cmake")
     add_links("benchmark_main", "benchmark")
     on_load("windows", function (package)
@@ -40,7 +44,7 @@ package("benchmark")
         end
     end)
 
-    on_install("macosx", "linux", "windows", function (package)
+    on_install("macosx", "linux", "windows", "mingw", function (package)
         local configs = {"-DBENCHMARK_ENABLE_TESTING=OFF", "-DBENCHMARK_INSTALL_DOCS=OFF"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
@@ -55,4 +59,4 @@ package("benchmark")
             BENCHMARK(BM_empty);
             BENCHMARK(BM_empty)->ThreadPerCpu();
         ]]}, {configs = {languages = "c++14"}, includes = "benchmark/benchmark.h"}))
-    end)
+    end)