Skip to content

Commit cd4045c

Browse files
committed
Add helper scripts
1 parent 36ec913 commit cd4045c

File tree

10 files changed

+193
-0
lines changed

10 files changed

+193
-0
lines changed

tools/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/config.sh

tools/env-32.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
2+
3+
. "$script_dir/config.sh"
4+
5+
export PKG_CONFIG_PATH="$OPENCV_32_PKG_CONFIG_PATH"
6+
export OPENCV_PACKAGE_NAME="$OPENCV_32_OPENCV_PACKAGE_NAME"
7+
export LD_LIBRARY_PATH="$OPENCV_32_LD_LIBRARY_PATH"
8+
export OPENCV_INCLUDE_PATHS="$OPENCV_32_OPENCV_INCLUDE_PATHS"

tools/env-34.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
2+
3+
. "$script_dir/config.sh"
4+
5+
export OpenCV_DIR="$OPENCV_34_CMAKE_DIR"
6+
export LD_LIBRARY_PATH="$OPENCV_34_LD_LIBRARY_PATH"

tools/env-4.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
4+
5+
. "$script_dir/config.sh"
6+
7+
export OpenCV_DIR="$OPENCV_4_CMAKE_DIR"
8+
export LD_LIBRARY_PATH="$OPENCV_4_LD_LIBRARY_PATH"
9+
export OPENCV_INCLUDE_PATHS="$OPENCV_4_OPENCV_INCLUDE_PATHS"

tools/generate-bindings.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
3+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
4+
5+
. "$script_dir/config.sh"
6+
7+
export RUSTFLAGS=-Clink-arg=-fuse-ld=lld
8+
export RUST_BACKTRACE=full
9+
SRC_CPP_DIR="$script_dir/../src_cpp/"
10+
OUT_DIR="$script_dir/../out/generator/"
11+
12+
cd "$script_dir/.."
13+
14+
if ! cargo build --release -p opencv-binding-generator --bin binding-generator; then
15+
exit
16+
fi
17+
18+
all_modules="alphamat
19+
aruco
20+
bgsegm
21+
bioinspired
22+
calib3d
23+
ccalib
24+
core
25+
cudaarithm
26+
cudabgsegm
27+
cudacodec
28+
cudafeatures2d
29+
cudafilters
30+
cudaimgproc
31+
cudaobjdetect
32+
cudaoptflow
33+
cudastereo
34+
cudawarping
35+
cvv
36+
dnn
37+
dnn_superres
38+
dpm
39+
face
40+
features2d
41+
flann
42+
freetype
43+
fuzzy
44+
gapi
45+
hdf
46+
hfs
47+
highgui
48+
img_hash
49+
imgcodecs
50+
imgproc
51+
intensity_transform
52+
line_descriptor
53+
mcc
54+
ml
55+
objdetect
56+
optflow
57+
ovis
58+
phase_unwrapping
59+
photo
60+
plot
61+
quality
62+
rapid
63+
rgbd
64+
saliency
65+
sfm
66+
shape
67+
stereo
68+
stitching
69+
structured_light
70+
superres
71+
surface_matching
72+
text
73+
tracking
74+
video
75+
videoio
76+
videostab
77+
viz
78+
xfeatures2d
79+
ximgproc
80+
xobjdetect
81+
xphoto
82+
wechat_qrcode
83+
"
84+
modules="${*:-$all_modules}"
85+
86+
for module in $modules; do
87+
rm -f "$OUT_DIR/$module.rs" "$OUT_DIR/$module.externs.rs" "$OUT_DIR/$module.cpp" "$OUT_DIR/ocvrs_ephemeral_$module.hpp"
88+
rm -f "$OUT_DIR"/???-"$module"-*.type.cpp "$OUT_DIR"/???-"$module"-*.type.rs
89+
done
90+
91+
export OPENCV_BINDING_GENERATOR_EMIT_DEBUG=1
92+
parallel --eta "$script_dir/../target/release/binding-generator" --debug "$OPENCV_4_HEADER_DIR" "$SRC_CPP_DIR" "$OUT_DIR" "{}" ::: $modules

tools/macos-sync.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
6+
7+
. "$script_dir/config.sh"
8+
9+
cd "$script_dir/.."
10+
11+
rsync -av --progress --exclude "/target" --exclude "/.idea" ./ "$MACOS_ADDR:opencv-rust/"

tools/regen-all.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
6+
7+
cd "$script_dir"
8+
9+
./regen.sh 32
10+
./regen.sh 34
11+
./regen.sh 4
12+
13+
rm -rf target/release/build/opencv-*

tools/regen.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
branch="$1"
6+
7+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
8+
9+
cd "$script_dir/.."
10+
11+
. "$script_dir/env-$branch.sh"
12+
13+
export RUSTFLAGS="-Clink-arg=-fuse-ld=lld"
14+
15+
touch build.rs
16+
cargo -vv test --release

tools/test.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
6+
cd "$script_dir/.."
7+
8+
export RUSTFLAGS="-Clink-arg=-fuse-ld=lld"
9+
export OS_FAMILY="linux"
10+
11+
(
12+
. "$script_dir/env-32.sh"
13+
ci/script.sh
14+
)
15+
16+
(
17+
. "$script_dir/env-34.sh"
18+
ci/script.sh
19+
)
20+
21+
(
22+
. "$script_dir/env-4.sh"
23+
ci/script.sh
24+
)
25+
26+
cargo clean

tools/win-sync.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
6+
7+
. "$script_dir/config.sh"
8+
9+
cd "$script_dir/.."
10+
11+
rsync -av --progress --exclude "/target" --exclude "/.idea" ./ "$WIN_ADDR:opencv-rust/"

0 commit comments

Comments
 (0)