-
Notifications
You must be signed in to change notification settings - Fork 1.8k
bazel build support #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
bazel build support #496
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,4 @@ rules.ninja | |
| # out-of-source build top-level folders. | ||
| build/ | ||
| _build/ | ||
| bazel-* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,393 @@ | ||
| cc_library( | ||
| name = "benchmark", | ||
| srcs = ["src/benchmark.cc"], | ||
| hdrs = ["include/benchmark/benchmark.h"], | ||
| strip_include_prefix = "include", | ||
| deps = [ | ||
| ":benchmark_api_internal", | ||
| ":benchmark_header", | ||
| ":benchmark_register", | ||
| ":check", | ||
| ":colorprint", | ||
| ":commandlineflags", | ||
| ":complexity", | ||
| ":console_reporter", | ||
| ":counter", | ||
| ":csv_reporter", | ||
| ":internal_macros", | ||
| ":json_reporter", | ||
| ":log", | ||
| ":mutex", | ||
| ":re", | ||
| ":reporter", | ||
| ":statistics", | ||
| ":string_util", | ||
| ":sysinfo", | ||
| ":timers", | ||
| ], | ||
| visibility = [ | ||
| "//visibility:public", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "arraysize", | ||
| hdrs = ["src/arraysize.h"], | ||
| strip_include_prefix = "src", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "benchmark_api_internal", | ||
| hdrs = ["src/benchmark_api_internal.h"], | ||
| strip_include_prefix = "src", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "benchmark_header", | ||
| hdrs = ["include/benchmark/benchmark.h"], | ||
| strip_include_prefix = "include", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "benchmark_register", | ||
| srcs = ["src/benchmark_register.cc"], | ||
| deps = [ | ||
| ":benchmark_api_internal", | ||
| ":benchmark_header", | ||
| ":check", | ||
| ":commandlineflags", | ||
| ":complexity", | ||
| ":internal_macros", | ||
| ":mutex", | ||
| ":re", | ||
| ":statistics", | ||
| ":string_util", | ||
| ":timers", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "check", | ||
| hdrs = ["src/check.h"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":internal_macros", | ||
| ":log", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "colorprint", | ||
| hdrs = ["src/colorprint.h"], | ||
| srcs = ["src/colorprint.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":check", | ||
| ":internal_macros", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "commandlineflags", | ||
| hdrs = ["src/commandlineflags.h"], | ||
| srcs = ["src/commandlineflags.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "complexity", | ||
| hdrs = ["src/complexity.h"], | ||
| srcs = ["src/complexity.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":check", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "console_reporter", | ||
| srcs = ["src/console_reporter.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":commandlineflags", | ||
| ":complexity", | ||
| ":colorprint", | ||
| ":counter", | ||
| ":string_util", | ||
| ":timers", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "counter", | ||
| hdrs = ["src/counter.h"], | ||
| srcs = ["src/counter.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "csv_reporter", | ||
| srcs = ["src/csv_reporter.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":complexity", | ||
| ":string_util", | ||
| ":timers", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "cycleclock", | ||
| hdrs = ["src/cycleclock.h"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ] | ||
| ) | ||
| cc_library( | ||
| name = "internal_macros", | ||
| hdrs = ["src/internal_macros.h"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "json_reporter", | ||
| srcs = ["src/json_reporter.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":complexity", | ||
| ":string_util", | ||
| ":timers", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "log", | ||
| hdrs = ["src/log.h"], | ||
| strip_include_prefix = "src", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "mutex", | ||
| hdrs = ["src/mutex.h"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "re", | ||
| hdrs = ["src/re.h"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ], | ||
| defines = ["HAVE_POSIX_REGEX"], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "reporter", | ||
| srcs = ["src/reporter.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":timers", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "sleep", | ||
| hdrs = ["src/sleep.h"], | ||
| srcs = ["src/sleep.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":internal_macros", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "statistics", | ||
| hdrs = ["src/statistics.h"], | ||
| srcs = ["src/statistics.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":benchmark_header", | ||
| ":check", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "string_util", | ||
| hdrs = ["src/string_util.h"], | ||
| srcs = ["src/string_util.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":arraysize", | ||
| ":internal_macros", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "sysinfo", | ||
| srcs = ["src/sysinfo.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":check", | ||
| ":cycleclock", | ||
| ":internal_macros", | ||
| ":sleep", | ||
| ":string_util", | ||
| ] | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "timers", | ||
| hdrs = ["src/timers.h"], | ||
| srcs = ["src/timers.cc"], | ||
| strip_include_prefix = "src", | ||
| deps = [ | ||
| ":check", | ||
| ":internal_macros", | ||
| ":sleep", | ||
| ":string_util", | ||
| ] | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "basic_test", | ||
| srcs = ["test/basic_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "benchmark_test", | ||
| srcs = ["test/benchmark_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "complexity_test", | ||
| srcs = ["test/complexity_test.cc"], | ||
| deps = [ | ||
| ":benchmark", | ||
| ":output_test", | ||
| ], | ||
| ) | ||
|
|
||
| #cc_test( | ||
| # name = "cxx03_test", | ||
| # srcs = ["test/cxx03_test.cc"], | ||
| # deps = [":benchmark"], | ||
| #) | ||
|
|
||
| cc_test( | ||
| name = "diagnostics_test", | ||
| srcs = ["test/diagnostics_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "donotoptimize_test", | ||
| srcs = ["test/donotoptimize_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "filter_test", | ||
| srcs = ["test/filter_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "fixture_test", | ||
| srcs = ["test/fixture_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "map_test", | ||
| srcs = ["test/map_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "multiple_ranges_test", | ||
| srcs = ["test/multiple_ranges_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "options_test", | ||
| srcs = ["test/options_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "register_benchmark_test", | ||
| srcs = ["test/register_benchmark_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "reporter_output_test", | ||
| srcs = ["test/reporter_output_test.cc"], | ||
| deps = [ | ||
| ":benchmark", | ||
| ":output_test", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "skip_with_error_test", | ||
| srcs = ["test/skip_with_error_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "templated_fixture_test", | ||
| srcs = ["test/templated_fixture_test.cc"], | ||
| deps = [":benchmark"], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "user_counters_tabular_test", | ||
| srcs = ["test/user_counters_tabular_test.cc"], | ||
| deps = [ | ||
| ":benchmark", | ||
| ":output_test", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "user_counters_test", | ||
| srcs = ["test/user_counters_test.cc"], | ||
| deps = [ | ||
| ":benchmark", | ||
| ":output_test", | ||
| ], | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "output_test", | ||
| hdrs = ["test/output_test.h"], | ||
| srcs = ["test/output_test_helper.cc"], | ||
| strip_include_prefix = "test", | ||
| deps = [ | ||
| ":benchmark_api_internal", | ||
| ":check", | ||
| ":re", | ||
| ], | ||
| ) | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note, this won't work for everyone. this is one of the reasons i held off; no way to do this kind of dynamic configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not perfect agreed, but it's also not unprecedented. gflags has a similar hardcoding (https://github.com/gflags/gflags/blob/master/bazel/gflags.bzl). I started a patch for moving some of the defines there to run off of a config but haven't gotten to a PR for that yet (googletest does something similar for linkopts: https://github.com/google/googletest/blob/master/BUILD.bazel).
But I know I don't have complete access to all the build modes I might need. Is there an automated build tool I can use to ensure coverage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the travis and appveyor builds are probably the closest we have for covering the various platforms/compilers. there are other platforms that people run on, but we don't have a way to cover every combination.