Function embed_resource::find_windows_sdk_tool[][src]

pub fn find_windows_sdk_tool<T: AsRef<str>>(tool: T) -> Option<PathBuf>

Find MSVC build tools other than the compiler and linker

On Windows + MSVC this can be used try to find tools such as MIDL.EXE in Windows Kits and/or SDK directories.

The compilers and linkers can be better found with the cc or vswhom crates. This always returns None on non-MSVC targets.

Examples

In your build script, find midl.exe and use it to compile an IDL file:

extern crate embed_resource;
extern crate vswhom;

let midl = embed_resource::find_windows_sdk_tool("midl.exe").unwrap();

// midl.exe uses cl.exe as a preprocessor, so it needs to be in PATH
let vs_locations = vswhom::VsFindResult::search().unwrap();
let output = Command::new(midl)
    .env("PATH", vs_locations.vs_exe_path.unwrap())
    .args(&["/out", &env::var("OUT_DIR").unwrap()])
    .arg("haka.pfx.idl").output().unwrap();

assert!(output.status.success());