Browse Source

Merge pull request #117 from Jascha-N/add-atlmfc-detection

Add ATL/MFC detection
vs2017
Alex Crichton 8 years ago
committed by GitHub
parent
commit
60e59fc0c2
  1. 17
      src/lib.rs
  2. 5
      src/windows_registry.rs

17
src/lib.rs

@ -353,6 +353,23 @@ impl Config {
self.compile_objects(&src_dst);
self.assemble(lib_name, &dst.join(output), &objects);
if self.get_target().contains("msvc") {
let compiler = self.get_base_compiler();
let atlmfc_lib = compiler.env().iter().find(|&&(ref var, _)| {
var == OsStr::new("LIB")
}).and_then(|&(_, ref lib_paths)| {
env::split_paths(lib_paths).find(|path| {
let sub = Path::new("atlmfc/lib");
path.ends_with(sub) || path.parent().map_or(false, |p| p.ends_with(sub))
})
});
if let Some(atlmfc_lib) = atlmfc_lib {
self.print(&format!("cargo:rustc-link-search=native={}",
atlmfc_lib.display()));
}
}
self.print(&format!("cargo:rustc-link-lib=static={}",
&output[3..output.len() - 2]));
self.print(&format!("cargo:rustc-link-search=native={}", dst.display()));

5
src/windows_registry.rs

@ -211,6 +211,11 @@ pub fn find_tool(target: &str, tool: &str) -> Option<Tool> {
let sub = otry!(vc_lib_subdir(target));
tool.libs.push(path.join("lib").join(sub));
tool.include.push(path.join("include"));
let atlmfc_path = path.join("atlmfc");
if atlmfc_path.exists() {
tool.libs.push(atlmfc_path.join("lib").join(sub));
tool.include.push(atlmfc_path.join("include"));
}
Some(tool)
}).next()
}

Loading…
Cancel
Save