|
| 1 | +licenses(['notice']) |
| 2 | +package(default_visibility=['//visibility:public']) |
| 3 | + |
| 4 | +BENCHMARK_COPTS = [ |
| 5 | + # Choose the regex backend by defining one of the macros below: |
| 6 | + # HAVE_GNU_POSIX_REGEX |
| 7 | + # HAVE_POSIX_REGEX |
| 8 | + # HAVE_STD_REGEX |
| 9 | + '-DHAVE_POSIX_REGEX', |
| 10 | + '-UNDEBUG', |
| 11 | + '-Wall', |
| 12 | + '-Wextra', |
| 13 | + '-Wfloat-equal', |
| 14 | + '-Wshadow', |
| 15 | + '-Wstrict-aliasing', |
| 16 | + '-Wzero-as-null-pointer-constant', |
| 17 | + '-fstrict-aliasing', |
| 18 | + '-pedantic', |
| 19 | + '-pedantic-errors', |
| 20 | + '-std=c++11', |
| 21 | +] |
| 22 | + |
| 23 | + |
| 24 | +GTEST_DEP = '@com_github_google_googletest//:gtest' |
| 25 | + |
| 26 | +cc_library( |
| 27 | + name = 'benchmark', |
| 28 | + srcs = [ |
| 29 | + 'src/arraysize.h', |
| 30 | + 'src/benchmark.cc', |
| 31 | + 'src/benchmark_api_internal.h', |
| 32 | + 'src/benchmark_register.cc', |
| 33 | + 'src/check.h', |
| 34 | + 'src/colorprint.cc', |
| 35 | + 'src/colorprint.h', |
| 36 | + 'src/commandlineflags.cc', |
| 37 | + 'src/commandlineflags.h', |
| 38 | + 'src/complexity.cc', |
| 39 | + 'src/complexity.h', |
| 40 | + 'src/console_reporter.cc', |
| 41 | + 'src/counter.cc', |
| 42 | + 'src/counter.h', |
| 43 | + 'src/csv_reporter.cc', |
| 44 | + 'src/cycleclock.h', |
| 45 | + 'src/internal_macros.h', |
| 46 | + 'src/json_reporter.cc', |
| 47 | + 'src/log.h', |
| 48 | + 'src/mutex.h', |
| 49 | + 'src/re.h', |
| 50 | + 'src/reporter.cc', |
| 51 | + 'src/sleep.cc', |
| 52 | + 'src/sleep.h', |
| 53 | + 'src/statistics.cc', |
| 54 | + 'src/statistics.h', |
| 55 | + 'src/string_util.cc', |
| 56 | + 'src/string_util.h', |
| 57 | + 'src/sysinfo.cc', |
| 58 | + 'src/timers.cc', |
| 59 | + 'src/timers.h', |
| 60 | + ], |
| 61 | + hdrs = [ |
| 62 | + 'include/benchmark/benchmark.h', |
| 63 | + ], |
| 64 | + includes = [ |
| 65 | + 'include', |
| 66 | + ], |
| 67 | + copts = BENCHMARK_COPTS, |
| 68 | + linkopts = [ |
| 69 | + '-lm', |
| 70 | + '-pthread', |
| 71 | + ], |
| 72 | +) |
| 73 | + |
| 74 | +[cc_test( |
| 75 | + name = f, |
| 76 | + srcs = [ |
| 77 | + 'test/%s.cc' % f, |
| 78 | + ], |
| 79 | + copts = BENCHMARK_COPTS, |
| 80 | + deps = [ |
| 81 | + ':benchmark', |
| 82 | + ], |
| 83 | + testonly = 1, |
| 84 | +) for f in [ |
| 85 | + 'basic_test', |
| 86 | + 'benchmark_test', |
| 87 | + 'diagnostics_test', |
| 88 | + 'donotoptimize_test', |
| 89 | + 'filter_test', |
| 90 | + 'fixture_test', |
| 91 | + 'map_test', |
| 92 | + 'multiple_ranges_test', |
| 93 | + 'options_test', |
| 94 | + 'register_benchmark_test', |
| 95 | + 'skip_with_error_test', |
| 96 | + 'templated_fixture_test', |
| 97 | + ] |
| 98 | +] |
| 99 | + |
| 100 | +[cc_test( |
| 101 | + name = f, |
| 102 | + srcs = [ |
| 103 | + 'test/%s.cc' % f, |
| 104 | + ], |
| 105 | + copts = BENCHMARK_COPTS, |
| 106 | + deps = [ |
| 107 | + ':output_test_helper', |
| 108 | + GTEST_DEP, |
| 109 | + ], |
| 110 | + testonly = 1, |
| 111 | +) for f in [ |
| 112 | + 'complexity_test', |
| 113 | + 'reporter_output_test', |
| 114 | + 'user_counters_tabular_test', |
| 115 | + 'user_counters_test', |
| 116 | + ] |
| 117 | +] |
| 118 | + |
| 119 | +cc_test( |
| 120 | + name = 'cxx03_test', |
| 121 | + srcs = [ |
| 122 | + 'test/cxx03_test.cc', |
| 123 | + ], |
| 124 | + copts = [ |
| 125 | + '-std=c++03', |
| 126 | + ], |
| 127 | + deps = [ |
| 128 | + ':benchmark', |
| 129 | + ], |
| 130 | + testonly = 1, |
| 131 | +) |
| 132 | + |
| 133 | +cc_library( |
| 134 | + name = 'output_test_helper', |
| 135 | + visibility = [ |
| 136 | + '//visibility:__pkg__', |
| 137 | + ], |
| 138 | + srcs = [ |
| 139 | + 'test/output_test_helper.cc', |
| 140 | + ], |
| 141 | + hdrs = [ |
| 142 | + 'test/output_test.h', |
| 143 | + ], |
| 144 | + strip_include_prefix = 'test', |
| 145 | + copts = BENCHMARK_COPTS, |
| 146 | + deps = [ |
| 147 | + ':benchmark', |
| 148 | + ], |
| 149 | + testonly = 1, |
| 150 | +) |
0 commit comments