]> git.proxmox.com Git - rustc.git/blob - compiler/rustc/build.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / compiler / rustc / build.rs
1 use std::env;
2
3 fn main() {
4 let target_os = env::var("CARGO_CFG_TARGET_OS");
5 let target_env = env::var("CARGO_CFG_TARGET_ENV");
6 if Ok("windows") == target_os.as_deref() && Ok("msvc") == target_env.as_deref() {
7 set_windows_exe_options();
8 }
9 }
10
11 // Add a manifest file to rustc.exe.
12 fn set_windows_exe_options() {
13 static WINDOWS_MANIFEST_FILE: &str = "Windows Manifest.xml";
14
15 let mut manifest = env::current_dir().unwrap();
16 manifest.push(WINDOWS_MANIFEST_FILE);
17
18 println!("cargo:rerun-if-changed={}", WINDOWS_MANIFEST_FILE);
19 // Embed the Windows application manifest file.
20 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFEST:EMBED");
21 println!("cargo:rustc-link-arg-bin=rustc-main=/MANIFESTINPUT:{}", manifest.to_str().unwrap());
22 // Turn linker warnings into errors.
23 println!("cargo:rustc-link-arg-bin=rustc-main=/WX");
24 }