From 1c531254a8342c7a9dd9db2715627e7449bc4cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 9 Sep 2020 19:30:56 -0700 Subject: Add libgoogle-benchmark-main module. This is useful for benchmarks that don't need a custom main(). Test: mm in external/google-benchmark Change-Id: I5de2e60ac080a288f06ee561ad3104429d679fc1 --- Android.bp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Android.bp b/Android.bp index e886e1c..88fe433 100644 --- a/Android.bp +++ b/Android.bp @@ -14,8 +14,8 @@ // limitations under the License. // -cc_library_static { - name: "libgoogle-benchmark", +cc_defaults { + name: "libgoogle-benchmark-defaults", host_supported: true, local_include_dirs: ["include"], vendor_available: true, @@ -25,16 +25,28 @@ cc_library_static { "-Werror", "-Wno-deprecated-declarations", ], - - exclude_srcs: [ - "src/benchmark_main.cc", - ], srcs: [ "src/*.cc", ], export_include_dirs: ["include"], } +// For benchmarks that define their own main(). +cc_library_static { + name: "libgoogle-benchmark", + defaults: ["libgoogle-benchmark-defaults"], + exclude_srcs: [ + "src/benchmark_main.cc", + ], +} + +// For benchmarks that want to use the default main(). +// Make sure this dependency is in the whole_static_libs attribute. +cc_library_static { + name: "libgoogle-benchmark-main", + defaults: ["libgoogle-benchmark-defaults"], +} + cc_test { name: "google-benchmark-test", srcs: ["test/basic_test.cc"], -- cgit v1.2.3