Skip to content

Commit 622f724

Browse files
authored
Merge pull request #7770 from Pinata-Consulting/bazel-docs-on-targets
bazel: a blurb about configurations
2 parents 5b9b002 + 06fb213 commit 622f724

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

docs/user/Bazel-targets.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Bazel targets
2+
3+
Bazel is a cross compilation system where `cfg=exec` is host and `cfg=target` is the microcontroller in a host compiler targeting a microcontroller scenario. Although there is no clear host and target scenario for OpenROAD, it is all host, the host/target concetps of Bazel brings some [surprises](https://en.wikipedia.org/wiki/Principle_of_least_astonishment) now and then when working with OpenROAD.
4+
5+
## What is host and what is target in an OpenROAD context?
6+
7+
Not surprisingly, the command below builds the `cfg=target` configuration:
8+
9+
bazelisk build -c opt :openroad
10+
11+
However, the tests run on the host:
12+
13+
bazelisk test ...
14+
15+
This, means that if one where to run, the commands below, OpenROAD would be built twice, first for `cfg=exec` and then for `cfg=target`:
16+
17+
bazelisk build -c opt :openroad
18+
bazelisk test ...
19+
20+
## Visualizing configurations and dependencies
21+
22+
This command will visualize the dependencies on `:openroad`:
23+
24+
bazelisk cquery -c opt --output=graph 'allpaths(//..., //:openroad)' | xdot /dev/stdin
25+
26+
![alt text](openroad-all-dependencies.png)
27+
28+
![alt text](openroad-cfg-exec.png)
29+
30+
To list configurations, noting `cfg=exec` are denoted with `(exec)`:
31+
32+
$ bazelisk config
33+
Available configurations:
34+
0f80209fc7e3c0c40539... k8-opt-exec-ST-6f5a6fb95be7 (exec)
35+
3a4b806bae496300ade4... k8-opt
36+
790a1ad93f643dd7c565... k8-opt-exec-ST-d57f47055a04 (exec)
37+
8472fe4754a50f76910e... k8-opt
38+
f37096aa0a6acd138bec... fastbuild-noconfig
413 KB
Loading

docs/user/openroad-cfg-exec.png

8.74 KB
Loading

0 commit comments

Comments
 (0)