about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorErick Tryzelaar <etryzelaar@google.com>2025-09-12 20:29:23 +0000
committerErick Tryzelaar <etryzelaar@google.com>2025-09-18 16:50:02 +0000
commit7f55f5761cd44b8ad49efb976ae650602fc2d42a (patch)
tree0ec94d43bc774fdf57e9d98ffdf5e0dd85374598 /compiler
parent32e3d9f59bae4bcf436bc1e28723c696d2c75b11 (diff)
downloadrust-7f55f5761cd44b8ad49efb976ae650602fc2d42a.tar.gz
rust-7f55f5761cd44b8ad49efb976ae650602fc2d42a.zip
Allow windows resource compiler to be overridden
It is now required to provide a resource compiler on windows when
compiling rust. This allows toolchain builders to explicitly provide a
path to an alternative, such as llvm-rc, instead of the one that's
provided by the Windows SDK.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_windows_rc/src/lib.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_windows_rc/src/lib.rs b/compiler/rustc_windows_rc/src/lib.rs
index caa5e5ef276..5e95557501e 100644
--- a/compiler/rustc_windows_rc/src/lib.rs
+++ b/compiler/rustc_windows_rc/src/lib.rs
@@ -35,8 +35,11 @@ pub fn compile_windows_resource_file(
     resources_dir.push("resources");
     fs::create_dir_all(&resources_dir).unwrap();
 
-    let resource_compiler =
-        find_resource_compiler(&env::var("CARGO_CFG_TARGET_ARCH").unwrap()).expect("found rc.exe");
+    let resource_compiler = if let Ok(path) = env::var("RUSTC_WINDOWS_RC") {
+        path.into()
+    } else {
+        find_resource_compiler(&env::var("CARGO_CFG_TARGET_ARCH").unwrap()).expect("found rc.exe")
+    };
 
     let rc_path = resources_dir.join(file_stem.with_extension("rc"));