review feedback: find lib root path from registry

This commit is contained in:
Martin Finkel 2019-08-05 16:24:20 +02:00
parent 3c6f6f0316
commit e3d8b6817e
5 changed files with 20 additions and 9 deletions

View file

@ -3126,6 +3126,7 @@ name = "rustc_target"
version = "0.0.0"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0",
"serialize 0.0.0",

View file

@ -11,6 +11,7 @@ path = "lib.rs"
[dependencies]
bitflags = "1.0"
log = "0.4"
cc = "1.0.1"
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_serialize = { path = "../libserialize", package = "serialize" }
syntax_pos = { path = "../libsyntax_pos" }

View file

@ -1,5 +1,5 @@
use crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy};
use std::env;
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -9,8 +9,11 @@ pub fn target() -> TargetResult {
// FIXME: this shouldn't be panic=abort, it should be panic=unwind
base.panic_strategy = PanicStrategy::Abort;
let lib_root_path = env::var("VCToolsInstallDir")
.expect("VCToolsInstallDir not found in env");
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",

View file

@ -1,5 +1,5 @@
use crate::spec::{LinkerFlavor, Target, TargetResult};
use std::env;
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -7,8 +7,11 @@ pub fn target() -> TargetResult {
base.max_atomic_width = Some(64);
base.has_elf_tls = true;
let lib_root_path = env::var("VCToolsInstallDir")
.expect("VCToolsInstallDir not found in env");
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",

View file

@ -1,5 +1,5 @@
use crate::spec::{LinkerFlavor, Target, TargetResult};
use std::env;
use cc::windows_registry;
pub fn target() -> TargetResult {
let mut base = super::windows_uwp_msvc_base::opts();
@ -7,8 +7,11 @@ pub fn target() -> TargetResult {
base.max_atomic_width = Some(64);
base.has_elf_tls = true;
let lib_root_path = env::var("VCToolsInstallDir")
.expect("VCToolsInstallDir not found in env");
let link_tool = windows_registry::find_tool("x86_64-pc-windows-msvc", "link.exe")
.expect("no path found for link.exe");
let original_path = link_tool.path();
let lib_root_path = original_path.ancestors().skip(4).next().unwrap().display();
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap()
.push(format!("{}{}{}",