姚凯文 姜嘉琪
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.9 KiB

  1. licenses(["notice"])
  2. config_setting(
  3. name = "qnx",
  4. constraint_values = ["@platforms//os:qnx"],
  5. values = {
  6. "cpu": "x64_qnx",
  7. },
  8. visibility = [":__subpackages__"],
  9. )
  10. config_setting(
  11. name = "windows",
  12. constraint_values = ["@platforms//os:windows"],
  13. values = {
  14. "cpu": "x64_windows",
  15. },
  16. visibility = [":__subpackages__"],
  17. )
  18. config_setting(
  19. name = "macos",
  20. constraint_values = ["@platforms//os:macos"],
  21. visibility = ["//visibility:public"],
  22. )
  23. config_setting(
  24. name = "perfcounters",
  25. define_values = {
  26. "pfm": "1",
  27. },
  28. visibility = [":__subpackages__"],
  29. )
  30. cc_library(
  31. name = "benchmark",
  32. srcs = glob(
  33. [
  34. "src/*.cc",
  35. "src/*.h",
  36. ],
  37. exclude = ["src/benchmark_main.cc"],
  38. ),
  39. hdrs = [
  40. "include/benchmark/benchmark.h",
  41. "include/benchmark/export.h",
  42. ],
  43. linkopts = select({
  44. ":windows": ["-DEFAULTLIB:shlwapi.lib"],
  45. "//conditions:default": ["-pthread"],
  46. }),
  47. strip_include_prefix = "include",
  48. visibility = ["//visibility:public"],
  49. # Only static linking is allowed; no .so will be produced.
  50. # Using `defines` (i.e. not `local_defines`) means that no
  51. # dependent rules need to bother about defining the macro.
  52. linkstatic = True,
  53. defines = [
  54. "BENCHMARK_STATIC_DEFINE",
  55. ] + select({
  56. ":perfcounters": ["HAVE_LIBPFM"],
  57. "//conditions:default": [],
  58. }),
  59. deps = select({
  60. ":perfcounters": ["@libpfm//:libpfm"],
  61. "//conditions:default": [],
  62. }),
  63. )
  64. cc_library(
  65. name = "benchmark_main",
  66. srcs = ["src/benchmark_main.cc"],
  67. hdrs = ["include/benchmark/benchmark.h", "include/benchmark/export.h"],
  68. strip_include_prefix = "include",
  69. visibility = ["//visibility:public"],
  70. deps = [":benchmark"],
  71. )
  72. cc_library(
  73. name = "benchmark_internal_headers",
  74. hdrs = glob(["src/*.h"]),
  75. visibility = ["//test:__pkg__"],
  76. )