fix broken build

This commit is contained in:
Niko 2023-09-25 08:55:09 -06:00
parent 749c18cfee
commit e6cbc75430
No known key found for this signature in database
GPG key ID: 3861E636EA1E0E2B
2 changed files with 38 additions and 13 deletions

View file

@ -63,8 +63,10 @@ This build may take a significant amount of time, but can save massive headaches
First, the `openvino` feature must be enabled in your Cargo.toml. First, the `openvino` feature must be enabled in your Cargo.toml.
Next, you must set the `OpenVINO_DIR` environment variable to the path where CMake can find Next, you must set the `OpenVINO_DIR` environment variable to the path where CMake can find
`OpenVINOConfig.cmake`. `OpenVINOConfig.cmake`, and the `OpenVINO_SO_DIR` tothe path where the OpenVINO shared
This is usually in the `cmake` directory of the OpenVINO installation. libraries are located.
The former is usually in the `runtime/cmake` directory of the OpenVINO installation, and the latter
is usually in `runtime/lib/intel64`.
If you used the AUR package to install OpenVINO, the location of this file is `/opt/intel/openvino/runtime/cmake`. If you used the AUR package to install OpenVINO, the location of this file is `/opt/intel/openvino/runtime/cmake`.

View file

@ -9,21 +9,39 @@ use std::path::PathBuf;
fn main() { fn main() {
// Fail-fast test for OpenVINO // Fail-fast test for OpenVINO
#[cfg(feature = "openvino")] #[cfg(feature = "openvino")]
if let Ok(openvino_dir) = env::var("OpenVINO_DIR") { {
// see if we can find OpenVINOConfig.cmake if let Ok(openvino_dir) = env::var("OpenVINO_DIR") {
let openvino_config_path = PathBuf::from(&openvino_dir).join("OpenVINOConfig.cmake"); // see if we can find OpenVINOConfig.cmake
if !openvino_config_path.exists() { let openvino_config_path = PathBuf::from(&openvino_dir).join("OpenVINOConfig.cmake");
panic!( if !openvino_config_path.exists() {
"Couldn't find OpenVINOConfig.cmake in OpenVINO_DIR. Please set it to the path where `OpenVINOConfig.cmake` can be found.\n\ 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\ 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." 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/`."
); );
} }
} else {
panic!( if let Ok(openvino_so_dir) = env::var("OpenVINO_SO_DIR") {
"Couldn't find the OpenVINO_DIR environment variable. Please set it to the path where `OpenVINOConfig.cmake` can be found.\n\ // check if `libopenvino.so` exists in the directory
On Arch Linux, if you installed the AUR package, this path is `/opt/intel/openvino/runtime/cmake/`." let openvino_so_path = PathBuf::from(&openvino_so_dir).join("libopenvino.so");
); if !openvino_so_path.exists() {
panic!(
"Couldn't find libopenvino.so in OpenVINO_SO_DIR. Please set it to the path where `libopenvino.so` can be found.\n\
On Arch Linux, if you installed the AUR package, this path is `/opt/intel/openvino/runtime/lib/intel64/`."
);
}
} else {
panic!(
"Couldn't find the OpenVINO_SO_DIR environment variable. Please set it to the path where `libopenvino.so` can be found.\n\
On Arch Linux, if you installed the AUR package, this path is `/opt/intel/openvino/runtime/lib/intel64/`."
)
}
} }
let target = env::var("TARGET").unwrap(); let target = env::var("TARGET").unwrap();
@ -66,6 +84,11 @@ fn main() {
} }
} }
} }
#[cfg(feature = "openvino")]
{
println!("cargo:rustc-link-lib=openvino");
println!("cargo:rustc-link-search={}", env::var("OpenVINO_SO_DIR").unwrap());
}
println!("cargo:rerun-if-changed=wrapper.h"); println!("cargo:rerun-if-changed=wrapper.h");
if env::var("WHISPER_DONT_GENERATE_BINDINGS").is_ok() { if env::var("WHISPER_DONT_GENERATE_BINDINGS").is_ok() {