Build //:benchmark as a static library only. (#1373)

If someone or something ever needs the dynamic library as a Bazel build
artifact, we can figure that out for them then, but right now, there is
no strong reason to be wrangling various `export.h`-controlling macros.

Fixes #1372.
This commit is contained in:
Paul Wankadia 2022-03-17 19:47:45 +11:00 committed by GitHub
parent 5704cd4c8c
commit 6a894bd555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -55,10 +55,11 @@ cc_library(
":windows": [], ":windows": [],
"//conditions:default": posix_copts, "//conditions:default": posix_copts,
}), }),
local_defines = select({ # Only static linking is allowed; no .so will be produced.
":windows": ["benchmark_EXPORTS"], # Using `defines` (i.e. not `local_defines`) means that no
"//conditions:default": [], # dependent rules need to bother about defining the macro.
}), linkstatic = True,
defines = ["BENCHMARK_STATIC_DEFINE"],
) )
cc_library( cc_library(

View File

@ -14,7 +14,6 @@ def py_extension(name, srcs, hdrs = [], copts = [], features = [], deps = []):
copts = copts, copts = copts,
features = features, features = features,
deps = deps, deps = deps,
local_defines = ["BENCHMARK_STATIC_DEFINE"],
) )
return native.py_library( return native.py_library(