This repository provides the configuration layer for all S-CORE C++ toolchains used in Bazel builds.
It contains no compiler binaries. Instead, it defines:
- Toolchain configurations
- Toolchain rules and extensions for Bzlmod
- Common compiler flags
- Templates for generating toolchain configs
- Package descriptors for external toolchain binaries
- Tests ensuring correct toolchain behavior
All toolchain binaries (GCC, QCC, etc.) are downloaded through Bazel repositories defined in consuming workspaces.
This repository is structured and versioned as a Bazel module and is intended to be consumed through MODULE.bazel.
- Provide a centralized, unified configuration source for all C++ toolchains used across S-CORE.
- Enforce consistency through shared flags, templates, and mandatory feature tests.
- Support multiple compilers (GCC, QCC) and multiple platforms (Linux, QNX).
- Ensure reproducible builds across architectures by separating:
- configuration logic (this repo).
- binary/toolchain distributions (external packages).
- Support plug-and-play toolchain activation via Bzlmod extensions.
.
├── bazel
│ ├── extentions/ # Module extensions for GCC/QCC toolchains
│ └── rules/ # Bazel rule implementations for toolchains
│
├── configurations # Shared and compiler-specific configuration flags
│ ├── common/
│ ├── gcc/
│ └── qcc/
│
├── packages # Toolchain package descriptors (no binaries)
│ ├── linux/ # Linux toolchain versions (GCC only)
│ ├── qnx/ # QNX SDP/QCC toolchain metadata
│ └── version_matrix.bzl # Supported toolchain version definitions
│
├── templates # Templates for BUILD and cc_toolchain_config.bzl
│ ├── common/
│ ├── gcc/
│ └── qcc/
│
├── tests # Functional tests for toolchain validation
│
├── docs # Sphinx documentation sources
│
├── tools # Utility scripts (e.g., QNX credential helper)
│
├── MODULE.bazel # Module declaration for Bzlmod
├── BUILD
├── LICENSE
├── NOTICE
└── README.md
This repository does not contain compiler binaries.
Instead:
- Toolchain packages describe how to fetch compiler binaries via
http_archiveor internal artifact storage. - Toolchain configurations describe how Bazel should use the binaries.
- Toolchain rules and extensions generate and register toolchains.
- Toolchain tests validate the toolchains.
- This separation provides:
- Hermetic configurations
- Full reproducibility
- Clear ownership boundaries
- Easy addition of new compilers or versions
bazel_dep(name = "score_cpp_toolchains", version = "0.1.0")
use_extension("@score_cpp_toolchains//bazel/extentions:gcc.bzl", "gcc")
gcc.use(
target_os = "linux",
target_cpu = "x86_64",
version = "12.2.0",
use_default_package = True,
)
use_repo("score_gcc_toolchain", "score_gcc_toolchain_pkg")
registry_toolchains("x86_64-linux-gcc-12.2.0")bazel_dep(name = "score_cpp_toolchains", version = "0.1.0")
use_extension("@score_cpp_toolchains//bazel/extentions:gcc.bzl", "qcc")
gcc.use(
target_cpu = "arm64",
sdp_version = "8.0.0",
use_default_package = True,
)
use_repo("score_qcc_toolchain", "score_qcc_toolchain_pkg")
registry_toolchains("x86_64-linux-qcc-12.2.0")Shared flag sets live under:
configurations/common/flags.bzlconfigurations/gcc/flags.bzlconfigurations/qcc/flags.bzl
These define:
- Base C/C++ flags
- Optimization flags
- PIC/PIE handling
- Debug and sanitizer modes
- Linker behavior
- Warning levels
Templates define how toolchain files are generated:
BUILD.templatecc_toolchain_config.bzl.template
These templates simplify adding:
- New compiler versions
- New compiler families
- New OS/arch combinations
Every toolchain must pass mandatory tests under tests/.
| Test Type | Purpose |
|---|---|
| Smoke tests | Validate tool presence |
| Feature tests | Verify compiler/linker capabilities |
| Integration tests | Validate Bazel builds using the toolchain |
Tests cover:
- Simple compilation (
main.cpp) - pthread linking (
main_pthread.cpp) - Toolchain registration behavior
Testing is part of the integration gate pipeline.
Documentation uses Sphinx and lives in docs/.
- Update
packages/version_matrix.bzl - Add a package descriptor (e.g.,
packages/linux/x86_64/gcc/13.1.0) - Generate configuration from templates
- Update flags if needed
- Run tests:
bazel test //tests/... - Submit through integration gate
Utility scripts such as:
tools/qnx_credential_helper.py
are used for repository authentication flows.
Distributed under:
LICENSENOTICE