Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 5.5 KB

defs.md

File metadata and controls

59 lines (39 loc) · 5.5 KB

This module provides the definitions for registering a GCC toolchain for C and C++.

gcc_toolchain

gcc_toolchain(name, binary_prefix, extra_cflags, extra_cxxflags, extra_fflags, extra_ldflags,
              gcc_toolchain_workspace_name, includes, repo_mapping, sysroot, target_arch,
              target_compatible_with, target_settings, toolchain_files_repository_name)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this repository. Name required
binary_prefix An explicit prefix used by each binary in bin/. String required
extra_cflags Extra flags for compiling C. List of strings optional []
extra_cxxflags Extra flags for compiling C++. List of strings optional []
extra_fflags Extra flags for compiling Fortran. List of strings optional []
extra_ldflags Extra flags for linking. %sysroot% is rendered to the sysroot path. %workspace% is rendered to the toolchain root path. See https://github.com/bazelbuild/bazel/blob/a48e246e/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java#L234-L254. List of strings optional []
gcc_toolchain_workspace_name The name given to the gcc-toolchain repository, if the default was not used. String optional "gcc_toolchain"
includes Extra includes for compiling C and C++. %sysroot% is rendered to the sysroot path. %workspace% is rendered to the toolchain root path. See https://github.com/bazelbuild/bazel/blob/a48e246e/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java#L234-L254. List of strings optional []
repo_mapping A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<p>For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). Dictionary: String -> String required
sysroot A sysroot to be used as the logical build root. String required
target_arch The target architecture this toolchain produces. E.g. x86_64. String required
target_compatible_with contraint_values passed to target_compatible_with of the toolchain. {target_arch} is rendered to the target_arch attribute value. List of strings optional ["@platforms//os:linux", "@platforms//cpu:{target_arch}"]
target_settings config_settings passed to target_compatible_with of the toolchain. {target_arch} is rendered to the target_arch attribute value. List of strings optional []
toolchain_files_repository_name The name of the repository containing the toolchain files. String required

gcc_register_toolchain

gcc_register_toolchain(name, target_arch, gcc_version, kwargs)

Declares a gcc_toolchain and calls register_toolchain for it.

PARAMETERS

Name Description Default Value
name The name passed to gcc_toolchain. none
target_arch The target architecture of the toolchain. none
gcc_version The version of GCC used by the toolchain. "10.3.0"
kwargs The extra arguments passed to gcc_toolchain. See gcc_toolchain for more info. none