Skip to content

Commit

Permalink
Use std::path::MAIN_SEPARATOR to join $OUT_DIR/lib$prefix.a on Win32 …
Browse files Browse the repository at this point in the history
…to fix builds where $PWD is a \?\ path

Closes: #71
Backported-from: 35a9ac6
  • Loading branch information
nabijaczleweli committed Nov 8, 2024
1 parent 81bead8 commit 7fa4ffa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/windows_msvc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::{PathBuf, Path, MAIN_SEPARATOR};
use std::sync::atomic::Ordering::SeqCst;
use std::sync::atomic::AtomicBool;
use std::path::{PathBuf, Path};
use self::super::apply_macros;
use std::process::Command;
use vswhom::VsFindResult;
Expand All @@ -26,7 +26,7 @@ impl ResourceCompiler {
}

pub fn compile_resource<Ms: AsRef<OsStr>, Mi: IntoIterator<Item = Ms>>(&self, out_dir: &str, prefix: &str, resource: &str, macros: Mi) -> String {
let out_file = format!("{}/{}.lib", out_dir, prefix);
let out_file = format!("{}{}{}.lib", out_dir, MAIN_SEPARATOR, prefix);
// `.res`es are linkable under MSVC as well as normal libraries.
if !apply_macros(Command::new(find_windows_sdk_tool_impl("rc.exe").as_ref().map_or(Path::new("rc.exe"), Path::new))
.args(&["/fo", &out_file, "/I", out_dir]),
Expand Down
4 changes: 2 additions & 2 deletions src/windows_not_msvc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::{PathBuf, MAIN_SEPARATOR};
use self::super::apply_macros;
use std::process::Command;
use std::path::PathBuf;
use std::borrow::Cow;
use std::ffi::OsStr;
use std::env;
Expand All @@ -22,7 +22,7 @@ impl ResourceCompiler {
}

pub fn compile_resource<Ms: AsRef<OsStr>, Mi: IntoIterator<Item = Ms>>(&self, out_dir: &str, prefix: &str, resource: &str, macros: Mi) -> String {
let out_file = format!("{}/lib{}.a", out_dir, prefix);
let out_file = format!("{}{}lib{}.a", out_dir, MAIN_SEPARATOR, prefix);

// Under some msys2 environments, $MINGW_CHOST has the correct target for
// GNU windres or llvm-windres (clang32, clang64, or clangarm64)
Expand Down

0 comments on commit 7fa4ffa

Please sign in to comment.