pub struct Config {
pub wdk_content_root: PathBuf,
pub driver_config: DriverConfig,
pub cpu_architecture: CPUArchitecture,
}
Expand description
Configuration parameters for a build dependent on the WDK
Fields§
§wdk_content_root: PathBuf
Path to root of WDK. Corresponds with WDKContentRoot environment varialbe in eWDK
driver_config: DriverConfig
Build configuration of driver
cpu_architecture: CPUArchitecture
CPU architecture to target
Implementations§
source§impl Config
impl Config
sourcepub fn from_env<S: AsRef<str> + Display>(
links_value: S
) -> Result<Self, ConfigFromEnvError>
pub fn from_env<S: AsRef<str> + Display>( links_value: S ) -> Result<Self, ConfigFromEnvError>
Creates a Config
from a config exported from a dependency. The
dependency must have exported a Config
via
Config::export_config
, and the dependency must have set a links
value in its Cargo manifiest to export the
DEP_<CARGO_MANIFEST_LINKS>_WDK_CONFIG
to downstream crates
§Errors
This function will return an error if the provided links_value
does
not correspond with a links value specified in the Cargo
manifest of one of the dependencies of the crate who’s build script
invoked this function.
sourcepub fn from_env_auto() -> Result<Self, ConfigFromEnvError>
pub fn from_env_auto() -> Result<Self, ConfigFromEnvError>
sourcepub fn get_include_paths(&self) -> Result<Vec<PathBuf>, ConfigError>
pub fn get_include_paths(&self) -> Result<Vec<PathBuf>, ConfigError>
Returns header include paths required to build and link based off of the
configuration of Config
§Errors
This function will return an error if any of the required paths do not exist.
sourcepub fn get_library_paths(&self) -> Result<Vec<PathBuf>, ConfigError>
pub fn get_library_paths(&self) -> Result<Vec<PathBuf>, ConfigError>
Returns library include paths required to build and link based off of
the configuration of Config
§Errors
This function will return an error if any of the required paths do not exist.
sourcepub fn configure_library_build(&self) -> Result<(), ConfigError>
pub fn configure_library_build(&self) -> Result<(), ConfigError>
Configures a Cargo build of a library that directly depends on the
WDK (i.e. not transitively via wdk-sys). This emits specially
formatted prints to Cargo based on this Config
.
This includes header include paths, linker search paths, library link directives, and WDK-specific configuration definitions. This must be called from a Cargo build script of the library.
§Errors
This function will return an error if any of the required paths do not exist.
§Panics
Panics if the invoked from outside a Cargo build environment
sourcepub fn configure_binary_build(&self)
pub fn configure_binary_build(&self)
Configures a Cargo build of a binary that depends on the WDK. This
emits specially formatted prints to Cargo based on this Config
.
This consists mainly of linker setting configuration. This must be called from a Cargo build script of the binary being built
sourcepub fn export_config(&self) -> Result<(), ExportError>
pub fn export_config(&self) -> Result<(), ExportError>
Serializes this Config
and exports it via the Cargo
DEP_<CARGO_MANIFEST_LINKS>_WDK_CONFIG
environment variable.
§Errors
This function will return an error if the crate does not have a links
field in its Cargo manifest or if it fails to serialize the config.
§Panics
Panics if this Config
fails to serialize.