|
|
|
@ -29,33 +29,47 @@ package("benchmark") |
|
|
|
|
add_extsources("brew::google-benchmark") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
if is_plat("linux") then |
|
|
|
|
if is_plat("linux", "bsd") then |
|
|
|
|
add_syslinks("pthread") |
|
|
|
|
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_configs("exceptions", {description = "Enable exception", default = true, type = "boolean"}) |
|
|
|
|
|
|
|
|
|
add_deps("cmake") |
|
|
|
|
add_links("benchmark_main", "benchmark") |
|
|
|
|
|
|
|
|
|
on_load("windows", function (package) |
|
|
|
|
if on_check then |
|
|
|
|
on_check("android", function (package) |
|
|
|
|
if package:is_plat("android") and package:is_arch("armeabi-v7a") then |
|
|
|
|
local ndk_sdkver = package:toolchain("ndk"):config("ndk_sdkver") |
|
|
|
|
if ndk_sdkver and tonumber(ndk_sdkver) < 24 then |
|
|
|
|
raise("package(benchmark) require ndk api >= 24") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
on_load(function (package) |
|
|
|
|
if not package:config("shared") then |
|
|
|
|
package:add("defines", "BENCHMARK_STATIC_DEFINE") |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
on_install("macosx", "linux", "windows", "mingw", function (package) |
|
|
|
|
if package:is_plat("windows") then |
|
|
|
|
os.mkdir(path.join(package:buildir(), "src/pdb")) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
local configs = {"-DBENCHMARK_ENABLE_TESTING=OFF", "-DBENCHMARK_INSTALL_DOCS=OFF"} |
|
|
|
|
on_install(function (package) |
|
|
|
|
local configs = { |
|
|
|
|
"-DBENCHMARK_ENABLE_TESTING=OFF", |
|
|
|
|
"-DBENCHMARK_INSTALL_DOCS=OFF", |
|
|
|
|
"-DBENCHMARK_ENABLE_WERROR=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")) |
|
|
|
|
table.insert(configs, "-DBENCHMARK_ENABLE_LTO=" .. (package:config("lto") and "ON" or "OFF")) |
|
|
|
|
table.insert(configs, "-DBENCHMARK_ENABLE_EXCEPTIONS=" .. (package:config("exceptions") and "ON" or "OFF")) |
|
|
|
|
if package:is_plat("windows") then |
|
|
|
|
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''") |
|
|
|
|
end |
|
|
|
|
import("package.tools.cmake").install(package, configs) |
|
|
|
|
|
|
|
|
|
if package:is_plat("windows") and package:is_debug() then |
|
|
|
|