Add a feature flag for Metal acceleration support
This commit is contained in:
parent
7dac364460
commit
253ac1bb6f
3 changed files with 17 additions and 0 deletions
15
sys/build.rs
15
sys/build.rs
|
|
@ -20,6 +20,12 @@ fn main() {
|
|||
println!("cargo:rustc-link-lib=framework=Foundation");
|
||||
println!("cargo:rustc-link-lib=framework=CoreML");
|
||||
}
|
||||
#[cfg(feature = "metal")]
|
||||
{
|
||||
println!("cargo:rustc-link-lib=framework=Foundation");
|
||||
println!("cargo:rustc-link-lib=framework=Metal");
|
||||
println!("cargo:rustc-link-lib=framework=MetalKit");
|
||||
}
|
||||
}
|
||||
|
||||
println!("cargo:rustc-link-search={}", env::var("OUT_DIR").unwrap());
|
||||
|
|
@ -118,6 +124,15 @@ fn main() {
|
|||
|
||||
#[cfg(feature = "opencl")]
|
||||
cmd.arg("-DWHISPER_CLBLAST=ON");
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "metal")] {
|
||||
cmd.arg("-DWHISPER_METAL=ON");
|
||||
} else {
|
||||
// Metal is enabled by default so we need to explicitly disable it
|
||||
cmd.arg("-DWHISPER_METAL=OFF");
|
||||
}
|
||||
};
|
||||
|
||||
cmd.arg("-DCMAKE_POSITION_INDEPENDENT_CODE=ON");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue