File tree Expand file tree Collapse file tree 6 files changed +22
-2
lines changed
compiler/rustc_windows_rc/src Expand file tree Collapse file tree 6 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 325
325
# Defaults to the Python interpreter used to execute x.py.
326
326
# build.python = "python"
327
327
328
+ # The path to (or name of) the resource compiler executable to use on Windows.
329
+ # build.windows-rc = "rc.exe"
330
+
328
331
# The path to the REUSE executable to use. Note that REUSE is not required in
329
332
# most cases, as our tooling relies on a cached (and shrunk) copy of the
330
333
# REUSE output present in the git repository and in our source tarballs.
Original file line number Diff line number Diff line change @@ -35,8 +35,11 @@ pub fn compile_windows_resource_file(
35
35
resources_dir. push ( "resources" ) ;
36
36
fs:: create_dir_all ( & resources_dir) . unwrap ( ) ;
37
37
38
- let resource_compiler =
39
- find_resource_compiler ( & env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ) . expect ( "found rc.exe" ) ;
38
+ let resource_compiler = if let Ok ( path) = env:: var ( "RUSTC_WINDOWS_RC" ) {
39
+ path. into ( )
40
+ } else {
41
+ find_resource_compiler ( & env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ) . expect ( "found rc.exe" )
42
+ } ;
40
43
41
44
let rc_path = resources_dir. join ( file_stem. with_extension ( "rc" ) ) ;
42
45
Original file line number Diff line number Diff line change @@ -1221,6 +1221,11 @@ impl Builder<'_> {
1221
1221
rustflags. arg ( "-Zehcont-guard" ) ;
1222
1222
}
1223
1223
1224
+ // Optionally override the rc.exe when compiling rustc on Windows.
1225
+ if let Some ( windows_rc) = & self . config . windows_rc {
1226
+ cargo. env ( "RUSTC_WINDOWS_RC" , windows_rc) ;
1227
+ }
1228
+
1224
1229
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
1225
1230
// This replaces spaces with tabs because RUSTDOCFLAGS does not
1226
1231
// support arguments with regular spaces. Hopefully someday Cargo will
Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ pub struct Config {
272
272
pub gdb : Option < PathBuf > ,
273
273
pub lldb : Option < PathBuf > ,
274
274
pub python : Option < PathBuf > ,
275
+ pub windows_rc : Option < PathBuf > ,
275
276
pub reuse : Option < PathBuf > ,
276
277
pub cargo_native_static : bool ,
277
278
pub configure_args : Vec < String > ,
@@ -449,6 +450,7 @@ impl Config {
449
450
nodejs : build_nodejs,
450
451
npm : build_npm,
451
452
python : build_python,
453
+ windows_rc : build_windows_rc,
452
454
reuse : build_reuse,
453
455
locked_deps : build_locked_deps,
454
456
vendor : build_vendor,
@@ -1339,6 +1341,7 @@ impl Config {
1339
1341
. unwrap_or ( rust_debug == Some ( true ) ) ,
1340
1342
vendor,
1341
1343
verbose_tests,
1344
+ windows_rc : build_windows_rc. map ( PathBuf :: from) ,
1342
1345
// tidy-alphabetical-end
1343
1346
}
1344
1347
}
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ define_config! {
37
37
nodejs: Option <String > = "nodejs" ,
38
38
npm: Option <String > = "npm" ,
39
39
python: Option <String > = "python" ,
40
+ windows_rc: Option <String > = "windows-rc" ,
40
41
reuse: Option <String > = "reuse" ,
41
42
locked_deps: Option <bool > = "locked-deps" ,
42
43
vendor: Option <bool > = "vendor" ,
Original file line number Diff line number Diff line change @@ -546,4 +546,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
546
546
severity : ChangeSeverity :: Info ,
547
547
summary : "The default value of the `gcc.download-ci-gcc` option has been changed to `true`." ,
548
548
} ,
549
+ ChangeInfo {
550
+ change_id : 146663 ,
551
+ severity : ChangeSeverity :: Info ,
552
+ summary : "New option `build.windows-rc` that will override which resource compiler on Windows will be used to compile Rust." ,
553
+ } ,
549
554
] ;
You can’t perform that action at this time.
0 commit comments