mirror of
https://github.com/google/benchmark.git
synced 2024-11-29 00:34:42 +00:00
6a894bd555
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.
26 lines
743 B
Python
26 lines
743 B
Python
_SHARED_LIB_SUFFIX = {
|
|
"//conditions:default": ".so",
|
|
"//:windows": ".dll",
|
|
}
|
|
|
|
def py_extension(name, srcs, hdrs = [], copts = [], features = [], deps = []):
|
|
for shared_lib_suffix in _SHARED_LIB_SUFFIX.values():
|
|
shared_lib_name = name + shared_lib_suffix
|
|
native.cc_binary(
|
|
name = shared_lib_name,
|
|
linkshared = True,
|
|
linkstatic = True,
|
|
srcs = srcs + hdrs,
|
|
copts = copts,
|
|
features = features,
|
|
deps = deps,
|
|
)
|
|
|
|
return native.py_library(
|
|
name = name,
|
|
data = select({
|
|
platform: [name + shared_lib_suffix]
|
|
for platform, shared_lib_suffix in _SHARED_LIB_SUFFIX.items()
|
|
}),
|
|
)
|