2018-03-08 12:48:46 +00:00
|
|
|
licenses(["notice"])
|
|
|
|
|
2021-06-28 12:46:08 +00:00
|
|
|
config_setting(
|
|
|
|
name = "qnx",
|
|
|
|
constraint_values = ["@platforms//os:qnx"],
|
|
|
|
values = {
|
|
|
|
"cpu": "x64_qnx",
|
|
|
|
},
|
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
2018-05-01 14:24:38 +00:00
|
|
|
config_setting(
|
|
|
|
name = "windows",
|
2021-06-28 12:46:08 +00:00
|
|
|
constraint_values = ["@platforms//os:windows"],
|
2020-09-03 09:59:15 +00:00
|
|
|
values = {
|
|
|
|
"cpu": "x64_windows",
|
|
|
|
},
|
2018-05-01 14:24:38 +00:00
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
Switch bindings implementation to `nanobind` (#1526)
* End support for Python 3.7, update cibuildwheel and publish actions
Removes Python 3.7 from the support matrix, since it does not support
PEP590 vectorcalls.
Bumps the `cibuildwheel` and `pypa-publish` actions to their latest
available versions respectively.
* Add nanobind to the Bazel dependencies, add a BUILD file
The build file builds nanobind as a static `cc_library`. Currently,
the git SHA points to HEAD, since some necessary features have not
been included in a release yet.
* Delete pybind11 BUILD file
* Switch bindings implementation to nanobind
Switches over the binding tool to `nanobind` from `pybind11`. Most
changes in the build setup itself were drop-in replacements of existing
code changed to nanobind names, no new concepts needed to be
implemented.
Sets the minimum required macOS to 10.14 for full C++17 support. Also,
to avoid ambiguities in Bazel, build for macOS 11 on Mac ARM64.
* Use Bazel select for linker options
Guards against unknown linker option errors by selecting required
linker options for nanobind only on macOS, where they are relevant.
Other changes:
* Bump cibuildwheel action to v2.12.0
* Bump Bazel for aarch64 linux wheels to 6.0.0
* Remove C++17 flag from build files since it is present in setup.py `bazel build` command
* Bump nanobind commit to current HEAD (TBD: Bump to next stable release)
* Unbreak Windows builds of nanobind-based bindings
Guards compiler options behind a new `select` macro choosing between
MSVC and not MSVC.
Other changes:
* Inject the proper C++17 standard cxxopt in the `setup.py` build
command.
* Bump nanobind to current HEAD.
* Make `macos` a benchmark-wide condition, with public visibility to
allow its use in the nanobind BUILD file.
* Fall back to `nb::implicitly_convertible` for Counter construction
Since `benchmark::Counter` only has a constructor for `double`,
the nanobind `nb::init_implicit` template cannot be used. Therefore,
to support implicit construction from ints, we fall back to the
`nb::implicitly_convertible` template instead.
2023-02-06 13:07:17 +00:00
|
|
|
config_setting(
|
|
|
|
name = "macos",
|
|
|
|
constraint_values = ["@platforms//os:macos"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
2022-10-31 11:03:59 +00:00
|
|
|
config_setting(
|
|
|
|
name = "perfcounters",
|
|
|
|
define_values = {
|
|
|
|
"pfm": "1",
|
|
|
|
},
|
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
2021-01-05 09:54:04 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark",
|
2018-05-25 10:18:58 +00:00
|
|
|
srcs = glob(
|
|
|
|
[
|
|
|
|
"src/*.cc",
|
|
|
|
"src/*.h",
|
|
|
|
],
|
|
|
|
exclude = ["src/benchmark_main.cc"],
|
|
|
|
),
|
2022-02-14 10:48:53 +00:00
|
|
|
hdrs = [
|
|
|
|
"include/benchmark/benchmark.h",
|
2022-07-26 08:00:49 +00:00
|
|
|
"include/benchmark/export.h",
|
2022-02-14 10:48:53 +00:00
|
|
|
],
|
2018-05-01 14:24:38 +00:00
|
|
|
linkopts = select({
|
2018-05-02 10:23:18 +00:00
|
|
|
":windows": ["-DEFAULTLIB:shlwapi.lib"],
|
2018-05-01 14:24:38 +00:00
|
|
|
"//conditions:default": ["-pthread"],
|
|
|
|
}),
|
2018-03-08 12:48:46 +00:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
visibility = ["//visibility:public"],
|
2022-03-17 08:47:45 +00:00
|
|
|
# Only static linking is allowed; no .so will be produced.
|
|
|
|
# Using `defines` (i.e. not `local_defines`) means that no
|
|
|
|
# dependent rules need to bother about defining the macro.
|
|
|
|
linkstatic = True,
|
2022-10-31 11:03:59 +00:00
|
|
|
defines = [
|
|
|
|
"BENCHMARK_STATIC_DEFINE",
|
|
|
|
] + select({
|
|
|
|
":perfcounters": ["HAVE_LIBPFM"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
|
|
|
deps = select({
|
|
|
|
":perfcounters": ["@libpfm//:libpfm"],
|
|
|
|
"//conditions:default": [],
|
|
|
|
}),
|
2018-03-08 12:48:46 +00:00
|
|
|
)
|
|
|
|
|
2018-05-25 10:18:58 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark_main",
|
|
|
|
srcs = ["src/benchmark_main.cc"],
|
2022-07-26 08:00:49 +00:00
|
|
|
hdrs = ["include/benchmark/benchmark.h", "include/benchmark/export.h"],
|
2018-05-25 10:18:58 +00:00
|
|
|
strip_include_prefix = "include",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = [":benchmark"],
|
|
|
|
)
|
|
|
|
|
2018-03-08 12:48:46 +00:00
|
|
|
cc_library(
|
|
|
|
name = "benchmark_internal_headers",
|
|
|
|
hdrs = glob(["src/*.h"]),
|
|
|
|
visibility = ["//test:__pkg__"],
|
|
|
|
)
|