benchmark: add mingw platform (#4085)

* fix mingw

* update xmake

* fix xmake
pull/4086/head
Linpeng Zhang 6 months ago committed by GitHub
parent 0fd452e023
commit b6028befa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      packages/b/benchmark/xmake.lua

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