mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Merge pull request #191 from NobodyXu/feature/target-detection-windows
feature: Detect `*-pc-windows-gnu` targets in `targets.rs`
This commit is contained in:
commit
ee4cbaa3d5
2 changed files with 27 additions and 2 deletions
|
@ -62,7 +62,7 @@ zip = { version = "0.6.2", default-features = false, features = [ "deflate", "bz
|
||||||
# Enable feature zstdmt to enable multithreading in libzstd.
|
# Enable feature zstdmt to enable multithreading in libzstd.
|
||||||
zstd = { version = "0.10.0", features = [ "bindgen", "zstdmt" ], default-features = false }
|
zstd = { version = "0.10.0", features = [ "bindgen", "zstdmt" ], default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies]
|
||||||
guess_host_triple = "0.1.3"
|
guess_host_triple = "0.1.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -32,6 +32,11 @@ pub async fn detect_targets() -> Vec<String> {
|
||||||
v.push(macos::X86.into());
|
v.push(macos::X86.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
if v[0].contains("gnu") {
|
||||||
|
v.push(v[0].replace("gnu", "msvc"));
|
||||||
|
}
|
||||||
|
|
||||||
v
|
v
|
||||||
} else {
|
} else {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
@ -42,7 +47,11 @@ pub async fn detect_targets() -> Vec<String> {
|
||||||
{
|
{
|
||||||
macos::detect_targets_macos()
|
macos::detect_targets_macos()
|
||||||
}
|
}
|
||||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
|
windows::detect_targets_windows()
|
||||||
|
}
|
||||||
|
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
|
||||||
{
|
{
|
||||||
vec![TARGET.into()]
|
vec![TARGET.into()]
|
||||||
}
|
}
|
||||||
|
@ -145,3 +154,19 @@ mod macos {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
mod windows {
|
||||||
|
use super::TARGET;
|
||||||
|
use guess_host_triple::guess_host_triple;
|
||||||
|
|
||||||
|
pub(super) fn detect_targets_windows() -> Vec<String> {
|
||||||
|
let mut targets = vec![guess_host_triple().unwrap_or(TARGET).to_string()];
|
||||||
|
|
||||||
|
if targets[0].contains("gnu") {
|
||||||
|
targets.push(targets[0].replace("gnu", "msvc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
targets
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue