Skip to content

Commit b059e58

Browse files
authored
Merge pull request #1 from uchen-ml/bazel-readme
Add Bazel notes
2 parents 236b078 + 84139f1 commit b059e58

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Please do not add dependencies without discussing them first.
2323

2424
## Setting up Visual Studio Code
2525

26-
Preferred tool chain is Clang/LLVM. Clangd extension is recommended.
26+
Preferred tool chain is Clang/LLVM. Clangd extension is recommended. I would strongly recommend installing the absolute latest version of Clangd from the LLVM website. The version in the Ubuntu repositories is very old and does not support many features.
2727

2828
1. Make sure Microsoft C++ tools are not installed.
2929
1. Install the extensions in `.vscode/extensions.json` (may need to re)
@@ -32,6 +32,16 @@ Preferred tool chain is Clang/LLVM. Clangd extension is recommended.
3232

3333
## Recipes
3434

35+
### Bazel
36+
37+
- `bazel build //...` - build everything
38+
- `bazel test //...` - run all tests. Use `--test_output=all` to see output from successful runs.
39+
- `bazel run //path/to:target` - run a binary target
40+
- `bazel run //path/to:target -- --flag=value output_file` - pass flags to the binary
41+
- `bazel test //path/to:target --test_output=all` - run a single test with all output
42+
- `--config=clang` after the verb (build/test/run) builds with Clang on Linux. `--config=asan` and `--config=ubsan` enable AddressSanitizer and UBSan, respectively. E.g. `bazel test --config=asan --config=clang //...` will run all tests with AddressSanitizer and Clang.
43+
- `--cxxopt` passes flags to the compiler. E.g. `--cxxopt=-march=native` will build for your CPU, helpful with SIMD. `--linkopt` passes flags to the linker.
44+
3545
### Logging
3646

3747
Rely on ABSL log. `LOG(INFO) << "Hello, world!";`

0 commit comments

Comments
 (0)