Skip to content

Commit e008501

Browse files
committed
Cleanup
1 parent 87bd0ba commit e008501

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use opencv::prelude::*;
3333

3434
OpenCV package in Arch is suitable for this:
3535

36-
`pacman -S clang qt5-base opencv`
36+
`pacman -S clang qt6-base opencv`
3737

3838
and additionally to support more OpenCV modules:
3939

@@ -281,18 +281,14 @@ The following variables are rarely used, but you might need them under some circ
281281
cmake (cmake related environment variables are applicable with this probe)
282282
* vcpkg
283283

284-
* `OPENCV_MODULE_WHITELIST` and `OPENCV_MODULE_BLACKLIST`
285-
Not used anymore. These used to be used to select modules that get their binding generated. We have switched to
286-
using cargo features for module selection. Please see the section on features to learn how to switch.
287-
288284
The following variables affect the building the of the `opencv` crate, but belong to external components:
289285

290286
* `PKG_CONFIG_PATH`
291287
Where to look for `*.pc` files see the [man pkg-config](https://linux.die.net/man/1/pkg-config)
292288
Path specified here must contain `opencv.pc` (pre OpenCV 4) or `opencv4.pc` (OpenCV 4 and later).
293289

294-
* `VCPKG_ROOT` and `VCPKGRS_DYNAMIC`
295-
The root of `vcpkg` installation and flag allowing use of `*.dll` libraries, see the
290+
* `VCPKG_ROOT`, `VCPKGRS_DYNAMIC` and `VCPKGRS_TRIPLET`
291+
The root of `vcpkg` installation, flag allowing use of `*.dll` libraries and selected `vcpkg` triplet, see the
296292
[documentation for `vcpkg` crate](https://docs.rs/vcpkg)
297293

298294
* `OpenCV_DIR`

binding-generator/src/type_ref/desc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ impl<'tu> ClangTypeExt<'tu> for Type<'tu> {
320320
match self.get_kind() {
321321
TypeKind::Void => TypeRefKind::Primitive("()", "void"),
322322
TypeKind::Bool => TypeRefKind::Primitive("bool", "bool"),
323-
TypeKind::CharS => TypeRefKind::Primitive("c_char", "char"),
324-
TypeKind::CharU => TypeRefKind::Primitive("c_char", "char"),
323+
TypeKind::CharS | TypeKind::CharU => TypeRefKind::Primitive("c_char", "char"),
325324
TypeKind::SChar => TypeRefKind::Primitive("i8", "signed char"),
326325
TypeKind::UChar => TypeRefKind::Primitive("u8", "unsigned char"),
327326
TypeKind::WChar => TypeRefKind::Primitive("u16", "wchar_t"),

build.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::collections::HashSet;
2+
use std::env;
23
use std::ffi::OsStr;
34
use std::fs::File;
45
use std::io::{BufRead, BufReader};
56
use std::path::{Path, PathBuf};
67
use std::time::Instant;
7-
use std::{env, iter};
88

99
use once_cell::sync::{Lazy, OnceCell};
1010
use semver::{Version, VersionReq};
@@ -49,7 +49,9 @@ static OPENCV_BRANCH_34: Lazy<VersionReq> =
4949
static OPENCV_BRANCH_4: Lazy<VersionReq> =
5050
Lazy::new(|| VersionReq::parse("~4").expect("Can't parse OpenCV 4 version requirement"));
5151

52-
static ENV_VARS: [&str; 16] = [
52+
/// Environment vars that affect the build, the source will be rebuilt if those change, the contents of those vars will also
53+
/// be present in the debug log
54+
static AFFECTING_ENV_VARS: [&str; 17] = [
5355
"OPENCV_PACKAGE_NAME",
5456
"OPENCV_PKGCONFIG_NAME",
5557
"OPENCV_CMAKE_NAME",
@@ -64,10 +66,14 @@ static ENV_VARS: [&str; 16] = [
6466
"PKG_CONFIG_PATH",
6567
"VCPKG_ROOT",
6668
"VCPKGRS_DYNAMIC",
69+
"VCPKGRS_TRIPLET",
6770
"OCVRS_DOCS_GENERATE_DIR",
6871
"DOCS_RS",
6972
];
7073

74+
/// The contents of these vars will be present in the debug log, but will not cause the source rebuild
75+
static DEBUG_ENV_VARS: [&str; 1] = ["PATH"];
76+
7177
pub enum GenerateFullBindings {
7278
Stop,
7379
Proceed,
@@ -260,7 +266,7 @@ fn build_compiler(opencv: &Library) -> cc::Build {
260266
}
261267

262268
fn setup_rerun() -> Result<()> {
263-
for &v in ENV_VARS.iter() {
269+
for &v in AFFECTING_ENV_VARS.iter() {
264270
println!("cargo:rerun-if-env-changed={v}");
265271
}
266272

@@ -306,7 +312,7 @@ fn main() -> Result<()> {
306312

307313
eprintln!("=== Crate version: {:?}", env::var_os("CARGO_PKG_VERSION"));
308314
eprintln!("=== Environment configuration:");
309-
for v in ENV_VARS.into_iter().chain(iter::once("PATH")) {
315+
for v in AFFECTING_ENV_VARS.into_iter().chain(DEBUG_ENV_VARS) {
310316
eprintln!("=== {v} = {:?}", env::var_os(v));
311317
}
312318
eprintln!("=== Enabled features:");

ci/install-windows-vcpkg.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ git checkout "$VCPKG_VERSION"
2121
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-windows.cmake
2222
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-windows-static.cmake
2323
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x86-windows.cmake
24+
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/community/x64-windows-static-md.cmake
2425
export VCPKG_DEFAULT_TRIPLET=x64-windows
2526
#./vcpkg install llvm # takes very long time
2627
choco install -y llvm --version "$CHOCO_LLVM_VERSION"

0 commit comments

Comments
 (0)