Skip to content

Commit 72b429e

Browse files
authored
Update README.md with new interface (#11)
Update README.md with new interface description.
1 parent dd3e774 commit 72b429e

3 files changed

Lines changed: 31 additions & 28 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module(
1515
name = "score_bazel_cpp_toolchains",
16-
version = "0.1.0",
16+
version = "0.2.0",
1717
compatibility_level = 0,
1818
)
1919

README.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,27 @@ This repository is structured and versioned as a Bazel module and is intended to
2626

2727
```bash
2828
.
29-
├── bazel
30-
│ ├── extentions/ # Module extensions for GCC/QCC toolchains
31-
│ └── rules/ # Bazel rule implementations for toolchains
3229
33-
├── configurations # Shared and compiler-specific configuration flags
34-
│ ├── common/
35-
│ ├── gcc/
36-
│ └── qcc/
30+
├── extentions # Module extensions for GCC/QCC toolchains
31+
│ ├── BUILD
32+
│ └── gcc.bzl
33+
34+
├── rules # Bazel rule implementations for toolchains
35+
│ ├── BUILD
36+
│ └── gcc.bzl
3737
3838
├── packages # Toolchain package descriptors (no binaries)
3939
│ ├── linux/ # Linux toolchain versions (GCC only)
4040
│ ├── qnx/ # QNX SDP/QCC toolchain metadata
4141
│ └── version_matrix.bzl # Supported toolchain version definitions
4242
43-
├── templates # Templates for BUILD and cc_toolchain_config.bzl
44-
│ ├── common/
45-
│ ├── gcc/
46-
│ └── qcc/
43+
├── templates # Templates for toolchain definition and configuration
44+
│ ├── linux/
45+
│ ├── qnx/
46+
│ ├── BUILD
47+
│ └── BUILD.template
4748
48-
├── tests # Functional tests for toolchain validation
49+
├── examples # Functional examples for toolchain validation
4950
5051
├── docs # Sphinx documentation sources
5152
@@ -64,9 +65,9 @@ This repository is structured and versioned as a Bazel module and is intended to
6465
This repository does not contain compiler binaries. </br>
6566
Instead:
6667
- Toolchain **packages** describe how to fetch compiler binaries via `http_archive` or internal artifact storage.
67-
- Toolchain **configurations** describe how Bazel should use the binaries.
68+
- Toolchain **templates** describe how Bazel should use the binaries.
6869
- Toolchain **rules** and **extensions** generate and register toolchains.
69-
- Toolchain **tests** validate the toolchains.
70+
- Toolchain **examples** validate the toolchains.
7071
- This separation provides:
7172
- Hermetic configurations
7273
- Full reproducibility
@@ -87,39 +88,40 @@ gcc.use(
8788
version = "12.2.0",
8889
use_default_package = True,
8990
)
90-
use_repo("score_gcc_toolchain", "score_gcc_toolchain_pkg")
91+
use_repo(gcc, "score_gcc_toolchain")
9192
```
9293

9394
### QCC Example (QNX ARM64)
9495

9596
```starlark
96-
bazel_dep(name = "score_cpp_toolchains", version = "0.1.0")
97-
use_extension("@score_cpp_toolchains//bazel/extentions:gcc.bzl", "qcc")
98-
qcc.use(
97+
bazel_dep(name = "score_cpp_toolchains", version = "0.2.0")
98+
use_extension("@score_cpp_toolchains//bazel/extentions:gcc.bzl", "gcc")
99+
gcc.use(
100+
target_os = "qnx",
99101
target_cpu = "arm64",
100102
sdp_version = "8.0.0",
103+
version = "12.2.0",
101104
use_default_package = True,
102105
)
103-
use_repo("score_qcc_toolchain", "score_qcc_toolchain_pkg")
106+
use_repo(gcc, "score_gcc_qnx_toolchain")
104107
```
105108

106109
The registration of toolchains is done by adding command line option `--extra_toolchains=@<toolchain_repo>//:toolchain_name`
107110
In case above this would be:
108111
```bash
109112
--extra_toolchains=@score_gcc_toolchain//:x86_64-linux-gcc-12.2.0
110-
--extra_toolchains=@score_qcc_toolchain//:x86_64-linux-qcc-12.2.0
113+
--extra_toolchains=@score_gcc_qnx_toolchain//:x86_64-linux-sdp-8.0.0
111114
```
112115

113116
> NOTE: In case that more than one toolchain needs to be defined, the registration must be protected via config flags otherwise</br>
114117
the first toolchain that matches constraints will be selected by toolchain resolutions.
115118

116119
## Configuration Flags
117120

118-
Shared flag sets live under:
121+
Shared flag sets live under:
119122

120-
- `configurations/common/flags.bzl`
121-
- `configurations/gcc/flags.bzl`
122-
- `configurations/qcc/flags.bzl`
123+
- [linux](templates/linux/cc_toolchain_flags.bzl.template)
124+
- [qnx](templates/qnx/cc_toolchain_config.bzl.template)
123125

124126
These define:
125127

@@ -136,6 +138,8 @@ Templates define how toolchain files are generated:
136138

137139
- `BUILD.template`
138140
- `cc_toolchain_config.bzl.template`
141+
- `cc_gcov_wrapper.template`
142+
- `cc_toolchain_flags.bzl.template`
139143

140144
These templates simplify adding:
141145

@@ -152,12 +156,11 @@ Testing is part of the **integration gate pipeline**.
152156
Example cover:
153157

154158
- Simple compilation ( [examples/main.cpp](./examples/main.cpp))
155-
- pthread linking ([examples/main_pthread.cpp](./examples/main_pthread.cpp))
156159
- Toolchain registration behavior ([examples/.bazelrc](./examples/.bazelrc))
157160

158161
# Documentation
159162

160-
Documentation uses **Sphinx** and lives in `docs/`.
163+
Documentation uses **Sphinx** and lives in `docs/`. (Not yet prepared!)
161164

162165
# Adding New Toolchain Versions
163166

examples/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bazel_dep(name = "rules_cc", version = "0.2.14")
4242
# *******************************************************************************
4343
bazel_dep(
4444
name = "score_bazel_cpp_toolchains",
45-
version = "0.1.0",
45+
version = "0.2.0",
4646
)
4747
local_path_override(
4848
module_name = "score_bazel_cpp_toolchains",

0 commit comments

Comments
 (0)