mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Support for macos in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
ca5c9b7c23
commit
4157f20b99
1 changed files with 20 additions and 2 deletions
|
@ -19,8 +19,10 @@ pub async fn detect_targets() -> Vec<Box<str>> {
|
|||
{
|
||||
return linux::detect_targets_linux().await;
|
||||
}
|
||||
|
||||
todo!()
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
macos::detect_targets_macos()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
|
@ -95,3 +97,19 @@ mod linux {
|
|||
target.into_boxed_str()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos {
|
||||
use guess_host_triple::guess_host_triple;
|
||||
|
||||
const AARCH64: &str = "aarch64-apple-darwin";
|
||||
const X86: &str = "x86_64-apple-darwin";
|
||||
|
||||
pub(super) fn detect_targets_macos() -> Vec<Box<str>> {
|
||||
if guess_host_triple() == Some(AARCH64) {
|
||||
vec![AARCH64.into(), X86.into()]
|
||||
} else {
|
||||
vec![X86.into()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue