Update regen script
ADD
tools/config.tpl.sh
+opencv_lib_base_dir="<home of the separate opencv install>"
+
+# 3.2
+OPENCV_32_PKG_CONFIG_PATH="$opencv_lib_base_dir/opencv-3.2/install/lib/pkgconfig/"
+OPENCV_32_OPENCV_PACKAGE_NAME="opencv"
+OPENCV_32_LD_LIBRARY_PATH="$opencv_lib_base_dir/opencv-3.2/install/lib/"
+OPENCV_32_OPENCV_INCLUDE_PATHS=+,/usr/include/eigen3/
+
+# 3.4
+OPENCV_34_CMAKE_DIR="$opencv_lib_base_dir/opencv-3.4/install/share/OpenCV"
+OPENCV_34_LD_LIBRARY_PATH="$opencv_lib_base_dir/opencv-3.4/install/lib64/"
+
+# 4.x
+OPENCV_4_CMAKE_DIR="$opencv_lib_base_dir/opencv-4/install/lib64/cmake/opencv4"
+OPENCV_4_HEADER_DIR="$opencv_lib_base_dir/opencv-4/install/include/opencv4"
+OPENCV_4_LD_LIBRARY_PATH="$opencv_lib_base_dir/opencv-4/install/lib64/"
+OPENCV_4_OPENCV_INCLUDE_PATHS=+,/opt/cuda/targets/x86_64-linux/include/
+
+# other OS machines
+BINDINGS_OUT_DIR="$opencv_lib_base_dir/bindings"
+MACOS_ADDR="<ssh address for macos machine>"
+WIN_ADDR="<ssh address for win machine>"

MODIFY
tools/regen.sh
tools/regen.sh
set -e
-branch="$1"
+branch="${1:-4}"
script_dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
@@ -12,5 +12,27 @@ cd "$script_dir/.."
export RUSTFLAGS="-Clink-arg=-fuse-ld=lld"
-touch build.rs
-cargo -vv test --release
+cd "$BINDINGS_OUT_DIR"
+
+bindings_dir="$BINDINGS_OUT_DIR/opencv-$branch"
+rm -rf "$bindings_dir"
+mkdir -p "$bindings_dir"
+
+temp_proj="opencv-temp-$branch"
+git clone --depth=1 "file://$script_dir/.." "$temp_proj"
+pushd "$temp_proj"
+
+cargo -vv build
+
+bindings_cpp_dir="$bindings_dir/cpp"
+mkdir -p "$bindings_cpp_dir"
+mv -v target/debug/build/opencv-*/out/*.{cpp,hpp} -t "$bindings_cpp_dir"
+
+bindings_rust_dir="$bindings_dir/rust"
+mkdir -p "$bindings_rust_dir"
+mv -v src/opencv/hub -t "$bindings_rust_dir"
+mv -v src/opencv/hub.rs -t "$bindings_rust_dir"
+
+popd
+
+rm -rf "$temp_proj"

Update regen script