Module cc_detect

Source
Expand description

C-compiler probing and detection.

This module will fill out the cc and cxx maps of Build by looking for C and C++ compilers for each target configured. A compiler is found through a number of vectors (in order of precedence)

  1. Configuration via target.$target.cc in bootstrap.toml.
  2. Configuration via target.$target.android-ndk in bootstrap.toml, if applicable
  3. Special logic to probe on OpenBSD
  4. The CC_$target environment variable.
  5. The CC environment variable.
  6. โ€œccโ€

Some of this logic is implemented here, but much of it is farmed out to the cc crate itself, so we end up having the same fallbacks as there. Similar logic is then used to find a C++ compiler, just some s/cc/c++/ is used.

It is intended that after this module has run no C/C++ compiler will ever be probed for. Instead the compilers found here will be used for everything.

Enumsยง

Language ๐Ÿ”’
Representing the target programming language for a native compiler.

Functionsยง

cc2ar ๐Ÿ”’
Finds archiver tool for the given target if possible. FIXME(onur-ozkan): This logic should be replaced by calling into the cc crate.
default_compiler ๐Ÿ”’
Determines the default compiler for a given target and language when not explicitly configured in bootstrap.toml.
find
Probes for C and C++ compilers and configures the corresponding entries in the Build structure.
find_target
Probes and configures the C and C++ compilers for a single target.
ndk_compiler ๐Ÿ”’
Constructs the path to the Android NDK compiler for the given target triple and language.
new_cc_build ๐Ÿ”’
Creates and configures a new cc::Build instance for the given target.