Skip to content

Commit

Permalink
User RC compiler for MSVC toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorc committed Jul 10, 2024
1 parent 04b941d commit f20ae48
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,27 @@ fn build_resource() -> Result<()> {
)?;
let output = std::path::PathBuf::from(&output_dir).join("resource.o");
#[allow(clippy::option_env_unwrap)]
let status = std::process::Command::new(
option_env!("WINDRES").expect("WINDRES envvar is undefined"),
)
.arg("-I")
.arg(&output_dir)
.arg("res/resource.rc")
.arg(&output)
.status()?;
let status = if let Some(windres) = option_env!("WINDRES") {
std::process::Command::new(windres)
.arg("-I")
.arg(&output_dir)
.arg("res/resource.rc")
.arg(&output)
.status()?
} else if let Some(rc) = option_env!("RC") {
std::process::Command::new(rc)
.arg("/i")
.arg(&output_dir)
.arg("/fo")
.arg(&output)
.arg("res/resource.rc")
.status()?
} else {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
"RC or WINDRES should be defined",
));
};
if !status.success() {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
Expand Down

0 comments on commit f20ae48

Please sign in to comment.