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.
Next, you must set the `OpenVINO_DIR` environment variable to the path where CMake can find
`OpenVINOConfig.cmake`.
This is usually in the `cmake` directory of the OpenVINO installation.
`OpenVINOConfig.cmake`, and the `OpenVINO_SO_DIR` tothe path where the OpenVINO shared
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`.

View file

@ -9,6 +9,7 @@ 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");
@ -26,6 +27,23 @@ fn main() {
);
}
if let Ok(openvino_so_dir) = env::var("OpenVINO_SO_DIR") {
// check if `libopenvino.so` exists in the directory
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();
// Link C++ standard library
if let Some(cpp_stdlib) = get_cpp_link_stdlib(&target) {
@ -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");
if env::var("WHISPER_DONT_GENERATE_BINDINGS").is_ok() {