xref: /aosp_15_r20/external/fmtlib/support/bazel/README.md (revision 5c90c05cd622c0a81b57953a4d343e0e489f2e08)
1*5c90c05cSAndroid Build Coastguard Worker# Bazel support
2*5c90c05cSAndroid Build Coastguard Worker
3*5c90c05cSAndroid Build Coastguard WorkerTo get [Bazel](https://bazel.build/) working with {fmt} you can copy the files `BUILD.bazel`,
4*5c90c05cSAndroid Build Coastguard Worker`MODULE.bazel`, `WORKSPACE.bazel`, and `.bazelversion` from this folder (`support/bazel`) to the root folder of this project.
5*5c90c05cSAndroid Build Coastguard WorkerThis way {fmt} gets bazelized and can be used with Bazel (e.g. doing a `bazel build //...` on {fmt}).
6*5c90c05cSAndroid Build Coastguard Worker
7*5c90c05cSAndroid Build Coastguard Worker## Using {fmt} as a dependency
8*5c90c05cSAndroid Build Coastguard Worker
9*5c90c05cSAndroid Build Coastguard Worker### Using Bzlmod
10*5c90c05cSAndroid Build Coastguard Worker
11*5c90c05cSAndroid Build Coastguard WorkerThe [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/fmt) provides support for {fmt}.
12*5c90c05cSAndroid Build Coastguard Worker
13*5c90c05cSAndroid Build Coastguard WorkerFor instance, to use {fmt} add to your `MODULE.bazel` file:
14*5c90c05cSAndroid Build Coastguard Worker
15*5c90c05cSAndroid Build Coastguard Worker```
16*5c90c05cSAndroid Build Coastguard Workerbazel_dep(name = "fmt", version = "10.2.1")
17*5c90c05cSAndroid Build Coastguard Worker```
18*5c90c05cSAndroid Build Coastguard Worker
19*5c90c05cSAndroid Build Coastguard Worker### Live at head
20*5c90c05cSAndroid Build Coastguard Worker
21*5c90c05cSAndroid Build Coastguard WorkerFor a live-at-head approach, you can copy the contents of this repository and move the Bazel-related build files to the root folder of this project as described above and make use of `local_path_override`, e.g.:
22*5c90c05cSAndroid Build Coastguard Worker
23*5c90c05cSAndroid Build Coastguard Worker```
24*5c90c05cSAndroid Build Coastguard Workerlocal_path_override(
25*5c90c05cSAndroid Build Coastguard Worker    module_name = "fmt",
26*5c90c05cSAndroid Build Coastguard Worker    path = "../third_party/fmt",
27*5c90c05cSAndroid Build Coastguard Worker)
28*5c90c05cSAndroid Build Coastguard Worker```
29