Expand description
The rsconf crate contains build.rs helper utilities and funcitionality to assist with
managing complicated build scripts, interacting with the native/system headers and libraries,
exposing rust constants based off of system headers, and conditionally compiling rust code based
off the presence or absence of certain functionality in the system headers and libraries.
This crate can be used standalone or in conjunction with the cc
crate when introspecting the build system’s environment.
In addition to facilitating easier ffi and other native system interop, rsconf also exposes a
strongly typed API for interacting with cargo at build-time and influencing its behavior,
including more user-friendly alternatives to the low-level println!("cargo:xxx") “api” used to
enable features, enable #[cfg(...)] conditional compilation blocks or define cfg values, and
more.
Macros§
- warn
- Emit a compile-time warning.
Structs§
- Target
- Exposes an interface for testing whether the target system supports a particular feature or
provides certain functionality. This is the bulk of the
rsconfapi.
Enums§
Functions§
- add_
library_ search_ path - Add a path to the list of directories rust will search when attempting to find a library to link against.
- debug
- Whether or not debug assertions are enabled.
- declare_
cfg - Informs the compiler of a
cfgwith the namename, possibly enabled. - declare_
cfg_ values - Inform the compiler of a cfg with name
nameand all its known valid values. - declare_
feature - Informs the compiler of a
featurewith the namename, possibly enabled. - enable_
cfg - Enables Cargo/rustc feature with the name
name. - enable_
feature - Enables a feature flag that compiles code annotated with
#[cfg(feature = "name")]. - host_
triple - The rustc/llvm triple of the host hardware/os/toolchain.
- link_
libraries - Instruct Cargo to link the target object against
librariesin the order provided. - link_
library - Instruct Cargo to link the target object against
library. - num_
jobs - The specified degree of build parallelism, defaulting to the host’s thread count.
- opt_
level - The optimization level specified for the build profile specified/being compiled.
- out_dir
- The output directory in which all output and intermediate artifacts should be placed.
- profile
- The selected build profile, e.g.
release,debug, or a custom profile as defined inCargo.toml. - rebuild_
if_ env_ changed - Instruct Cargo to rerun the build script if the named environment variable changes.
- rebuild_
if_ envs_ changed - Instruct Cargo to rerun the build script if any of the named environment variables change.
- rebuild_
if_ path_ changed - Instruct Cargo to rerun the build script if the provided path changes.
- rebuild_
if_ paths_ changed - Instruct Cargo to rerun the build script if any of the provided paths change.
- rustc
- The path to the
rustccompiler being used. - rustc_
linker - The path to the linker
cargohas been configured to use for the current target, if any. - rustc_
workspace_ wrapper - The
rustcwrapper used for the workspace, if any. - rustc_
wrapper - The
rustcwrapper configured with theRUSTC_WRAPPERenvironment variable, if any. - rustdoc
- The path to the
rustdoccompiler being used. - rustflags
- All the extra flags
rustcwill ultimately be invoked with. - set_
cfg_ value - Activates conditional compilation for code behind
#[cfg(name = "value")]or withif cfg!(name = "value"). - set_
env_ value - Makes an environment variable available to your code at build time, letting you use the value as
a compile-time constant with
env!(NAME). - target_
triple - The rustc/llvm triple of the target hardware/os/toolchain.