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
rsconf
api.
Enums§
- Link
Type - Specifies how a dependency library is linked.
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.
- declare_
cfg - Informs the compiler of a
cfg
with the namename
, possibly enabled. - declare_
cfg_ values - Inform the compiler of a cfg with name
name
and all its known valid values. - declare_
feature - Informs the compiler of a
feature
with 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")]
. - link_
libraries - Instruct Cargo to link the target object against
libraries
in the order provided. - link_
library - Instruct Cargo to link the target object against
library
. - 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.
- 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)
.