xref: /aosp_15_r20/external/google-benchmark/bazel/benchmark_deps.bzl (revision dbb99499c3810fa1611fa2242a2fc446be01a57c)
1"""
2This file contains the Bazel build dependencies for Google Benchmark (both C++ source and Python bindings).
3"""
4
5load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
6load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
7
8def benchmark_deps():
9    """Loads dependencies required to build Google Benchmark."""
10
11    if "bazel_skylib" not in native.existing_rules():
12        http_archive(
13            name = "bazel_skylib",
14            sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
15            urls = [
16                "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
17                "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
18            ],
19        )
20
21    if "rules_foreign_cc" not in native.existing_rules():
22        http_archive(
23            name = "rules_foreign_cc",
24            sha256 = "476303bd0f1b04cc311fc258f1708a5f6ef82d3091e53fd1977fa20383425a6a",
25            strip_prefix = "rules_foreign_cc-0.10.1",
26            url = "https://github.com/bazelbuild/rules_foreign_cc/releases/download/0.10.1/rules_foreign_cc-0.10.1.tar.gz",
27        )
28
29    if "rules_python" not in native.existing_rules():
30        http_archive(
31            name = "rules_python",
32            sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
33            strip_prefix = "rules_python-0.27.1",
34            url = "https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz",
35        )
36
37    if "com_google_googletest" not in native.existing_rules():
38        new_git_repository(
39            name = "com_google_googletest",
40            remote = "https://github.com/google/googletest.git",
41            tag = "release-1.12.1",
42        )
43
44    if "nanobind" not in native.existing_rules():
45        new_git_repository(
46            name = "nanobind",
47            remote = "https://github.com/wjakob/nanobind.git",
48            tag = "v1.9.2",
49            build_file = "@//bindings/python:nanobind.BUILD",
50            recursive_init_submodules = True,
51        )
52
53    if "libpfm" not in native.existing_rules():
54        # Downloaded from v4.9.0 tag at https://sourceforge.net/p/perfmon2/libpfm4/ref/master/tags/
55        http_archive(
56            name = "libpfm",
57            build_file = str(Label("//tools:libpfm.BUILD.bazel")),
58            sha256 = "5da5f8872bde14b3634c9688d980f68bda28b510268723cc12973eedbab9fecc",
59            type = "tar.gz",
60            strip_prefix = "libpfm-4.11.0",
61            urls = ["https://sourceforge.net/projects/perfmon2/files/libpfm4/libpfm-4.11.0.tar.gz/download"],
62        )
63