Expand description
A small crate used for supplying helpers to build.rs scripts.
This just simplifies writing build.rs scripts and helps to make them more
generally readable.
This crate should not ever be included as a [dependency].
Macros§
- The
out_dirmacro provides an easy mechanism for retrieving theOUT_DIRenvironment variable that is implicitly defined at runtime in build scripts. - The
rerun_if_changedinstruction tells Cargo to re-run the build script if the file at the given path has changed. Currently, Cargo only uses the filesystem last-modified “mtime” timestamp to determine if the file has changed. It compares against an internal cached timestamp of when the build script last ran. - The
rerun_if_env_changedinstruction tells Cargo to re-run the build script if the value of an environment variable of the given name has changed. - The
rustc_cdylib_link_arginstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building a cdylib library target. Its usage is highly platform specific. It is useful to set the shared library version or the runtime-path. - The
rustc_cfginstruction tells Cargo to pass the given value to the--cfg flagto the compiler. This may be used for compile-time detection of features to enable conditional compilation. - The
rustc_envinstruction tells Cargo to set the given environment variable when compiling the package. The value can be then retrieved by the env! macro in the compiled crate. This is useful for embedding additional metadata in crate’s code, such as the hash of git HEAD or the unique identifier of a continuous integration server. - The
rustc_flagsinstruction tells Cargo to pass the given space-separated flags to the compiler. This only allows the-land-Lflags, and is equivalent to usingrustc-link-libandrustc-link-search. - The
rustc_link_arg_benchesinstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building a benchmark target. - The
rustc_link_arg_bininstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building the binary target with name BIN. Its usage is highly platform specific. It is useful to set a linker script or other linker options. - The
rustc_link_arg_binsinstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building a binary target. Its usage is highly platform specific. It is useful to set a linker script or other linker options. - The
rustc_link_arg_examplesinstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building an examples target. - The
rustc_link_arg_testsinstruction tells Cargo to pass the-C link-arg=FLAGoption to the compiler, but only when building a tests target. - The
rustc_link_libinstruction tells Cargo to link the given library using the compiler’s-lflag. This is typically used to link a native library using FFI. - The
rustc_link_searchinstruction tells Cargo to pass the -L flag to the compiler to add a directory to the library search path. - The
warninginstruction tells Cargo to display a warning after the build script has finished running. Warnings are only shown for path dependencies (that is, those you’re working on locally), so for example warnings printed out in crates.io crates are not emitted by default. The-vv` “very verbose” flag may be used to have Cargo display warnings for all crates.