Skip to content

Commit da5264e

Browse files
[bazel][docs] Update build documentation (#99339)
This PR updates the Quick Start section to provide more detailed build instructions.
1 parent 194f98c commit da5264e

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

utils/bazel/README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,31 @@ for adding this configuration.
3333
[bazelisk](https://github.com/bazelbuild/bazelisk) which automates
3434
downloading the proper bazel version
3535
3. `cd utils/bazel`
36-
4. `bazel build --config=generic_clang @llvm-project//...`
37-
* If you're using clang, it's expected that lld is also available
38-
* If you're using MSVC or gcc, instead of `--config=generic_clang`, pass
39-
`--config=generic_gcc` or `--config=msvc`
40-
* To specify a specific local compiler to use, add the following bazel
41-
flag: `--repo_env=CC=/usr/bin/clang`
42-
* `--config=generic_clang`/`--config=generic_gcc` by default set
43-
`--repo_env=CC=clang`/`--repo_env=CC=gcc`, using `clang`/`gcc` on the
44-
`PATH`
36+
4. The `bazel build` command depends on the local compiler you want to use.
37+
* For **clang**, go to step 5.
38+
* For **gcc** or **MSVC**, go to step 6
39+
5. If you are using **clang**, it is expected that lld is also available.
40+
The `--config=generic_clang` flag by default sets the compiler to be `clang`
41+
binary on the `PATH`.
42+
```
43+
bazel build --config=generic_clang @llvm-project//...
44+
```
45+
To provide a specific path to your `clang`, use the `--repo_env` Bazel flag.
46+
For example:
47+
```
48+
bazel build --config=generic_clang --repo_env=CC=/usr/bin/clang --repo_env=CXX=/usr/bin/clang++ @llvm-project//...
49+
```
50+
6. If you are using **gcc** or **MSVC**, instead of `--config=generic_clang`
51+
, pass `--config=generic_gcc` or `--config=generic_msvc`, which sets the
52+
compiler to be `gcc` binary on the `PATH`.
53+
```
54+
bazel build --config=generic_gcc @llvm-project//...
55+
```
56+
To provide a specific path to your `gcc`, use the `--repo_env` Bazel flag.
57+
For example:
58+
```
59+
bazel build --config=generic_gcc --repo_env=CC=/usr/bin/gcc --repo_env=CXX=/usr/bin/g++ @llvm-project//...
60+
```
4561

4662
# Configuration
4763

0 commit comments

Comments
 (0)