Skip to content

Commit 9b14dc0

Browse files
committed
Add workaround for the wrong detected include path with vcpkg
1 parent 433e430 commit 9b14dc0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

build/library.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,21 @@ impl Library {
387387
}
388388
let opencv = opencv.ok_or_else(|| errors.join(", "))?;
389389

390-
let version = Self::version_from_include_paths(&opencv.include_paths);
390+
let mut opencv_include_paths = opencv.include_paths;
391+
392+
let mut version = Self::version_from_include_paths(&opencv_include_paths);
393+
// workaround for the wrong detected include path for vcpkg 2024.11.16+: https://github.com/twistedfall/opencv-rust/issues/640
394+
if version.is_none() {
395+
for include_path in &mut opencv_include_paths {
396+
if include_path.ends_with("include") {
397+
include_path.push("opencv4");
398+
version = Self::version_from_include_paths(&[include_path]);
399+
break;
400+
}
401+
}
402+
}
391403

392-
let include_paths = Self::process_env_var_list(include_paths, opencv.include_paths);
404+
let include_paths = Self::process_env_var_list(include_paths, opencv_include_paths);
393405

394406
let mut cargo_metadata = opencv.cargo_metadata;
395407

0 commit comments

Comments
 (0)