Crate rsconf

source ·
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§

  • Emit a compile-time warning.

Structs§

  • Exposes an interface for testing whether the target system supports a particular feature or provides certain functionality. This is the bulk of the rsconf api.

Enums§

  • Specifies how a dependency library is linked.

Functions§

  • Add a path to the list of directories rust will search when attempting to find a library to link against.
  • Informs the compiler of a cfg with the name name, enabled if enabled is set to true.
  • Inform the compiler of all known valid values for cfg name.
  • Enables conditional compilation of code behind #[cfg(name)] or with if cfg!(name) (without quotes around name).
  • Enables a feature flag that compiles code annotated with #[cfg(feature = "name")].
  • Instruct Cargo to link the target object against libraries in the order provided.
  • Instruct Cargo to link the target object against library.
  • Instruct Cargo to rerun the build script if the named environment variable changes.
  • Instruct Cargo to rerun the build script if any of the named environment variables change.
  • Instruct Cargo to rerun the build script if the provided path changes.
  • Instruct Cargo to rerun the build script if any of the provided paths change.
  • Activates conditional compilation for code behind #[cfg(name = "value")] or with if cfg!(name = "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).