mirror of
https://github.com/google/benchmark.git
synced 2024-12-27 13:00:36 +08:00
e057a7cee2
* Make generate_export_header.bzl work for Windows. While I'm here, bring the generated code slightly closer to what CMake would generate nowadays. Fixes #1351. * Fix define. * Fix export_import_condition. * Fix guard.
82 lines
1.9 KiB
Python
82 lines
1.9 KiB
Python
licenses(["notice"])
|
|
|
|
load("//:config/generate_export_header.bzl", "generate_export_header")
|
|
|
|
posix_copts = [
|
|
"-fvisibility=hidden",
|
|
"-fvisibility-inlines-hidden",
|
|
]
|
|
|
|
# Generate header to provide ABI export symbols
|
|
generate_export_header(
|
|
out = "include/benchmark/export.h",
|
|
lib = "benchmark",
|
|
static_define = "BENCHMARK_STATIC_DEFINE",
|
|
)
|
|
|
|
config_setting(
|
|
name = "qnx",
|
|
constraint_values = ["@platforms//os:qnx"],
|
|
values = {
|
|
"cpu": "x64_qnx",
|
|
},
|
|
visibility = [":__subpackages__"],
|
|
)
|
|
|
|
config_setting(
|
|
name = "windows",
|
|
constraint_values = ["@platforms//os:windows"],
|
|
values = {
|
|
"cpu": "x64_windows",
|
|
},
|
|
visibility = [":__subpackages__"],
|
|
)
|
|
|
|
cc_library(
|
|
name = "benchmark",
|
|
srcs = glob(
|
|
[
|
|
"src/*.cc",
|
|
"src/*.h",
|
|
],
|
|
exclude = ["src/benchmark_main.cc"],
|
|
),
|
|
hdrs = [
|
|
"include/benchmark/benchmark.h",
|
|
"include/benchmark/export.h", # From generate_export_header
|
|
],
|
|
linkopts = select({
|
|
":windows": ["-DEFAULTLIB:shlwapi.lib"],
|
|
"//conditions:default": ["-pthread"],
|
|
}),
|
|
strip_include_prefix = "include",
|
|
visibility = ["//visibility:public"],
|
|
copts = select({
|
|
":windows": [],
|
|
"//conditions:default": posix_copts,
|
|
}),
|
|
local_defines = select({
|
|
":windows": ["benchmark_EXPORTS"],
|
|
"//conditions:default": [],
|
|
}),
|
|
)
|
|
|
|
cc_library(
|
|
name = "benchmark_main",
|
|
srcs = ["src/benchmark_main.cc"],
|
|
hdrs = ["include/benchmark/benchmark.h"],
|
|
strip_include_prefix = "include",
|
|
visibility = ["//visibility:public"],
|
|
deps = [":benchmark"],
|
|
copts = select({
|
|
":windows": [],
|
|
"//conditions:default": posix_copts,
|
|
}),
|
|
)
|
|
|
|
cc_library(
|
|
name = "benchmark_internal_headers",
|
|
hdrs = glob(["src/*.h"]),
|
|
visibility = ["//test:__pkg__"],
|
|
)
|