Add OpenVINO support

This commit is contained in:
Zero 2023-08-28 16:28:43 -06:00
parent 776abc3c91
commit 5c140c14d4
No known key found for this signature in database
GPG key ID: 3861E636EA1E0E2B
6 changed files with 100 additions and 2 deletions

View file

@ -33,6 +33,7 @@ include = [
coreml = []
cuda = []
opencl = []
openvino = []
[dependencies]

View file

@ -7,6 +7,26 @@ use std::env;
use std::path::PathBuf;
fn main() {
// Fail-fast test for OpenVINO
#[cfg(feature = "openvino")]
if let Ok(openvino_dir) = env::var("OpenVINO_DIR") {
// see if we can find OpenVINOConfig.cmake
let openvino_config_path = PathBuf::from(&openvino_dir).join("OpenVINOConfig.cmake");
if !openvino_config_path.exists() {
panic!(
"Couldn't find OpenVINOConfig.cmake in OpenVINO_DIR. Please set it to the path where `OpenVINOConfig.cmake` can be found.\n\
On Arch Linux, if you installed the AUR package, this path is `/opt/intel/openvino/runtime/cmake/`.\n\
Note the `/cmake/` at the end of the path."
);
}
} else {
panic!(
"Couldn't find the OpenVINO_DIR environment variable. Please set it to the path where `OpenVINOConfig.cmake` can be found.\n\
On Arch Linux, if you installed the AUR package, this path is `/opt/intel/openvino/runtime/cmake/`."
);
}
let target = env::var("TARGET").unwrap();
// Link C++ standard library
if let Some(cpp_stdlib) = get_cpp_link_stdlib(&target) {
@ -112,6 +132,9 @@ fn main() {
#[cfg(feature = "opencl")]
cmd.arg("-DWHISPER_CLBLAST=ON");
#[cfg(feature = "openvino")]
cmd.arg("-DWHISPER_OPENVINO=1");
cmd.arg("-DCMAKE_POSITION_INDEPENDENT_CODE=ON");
let code = cmd