This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
forked from khoren93/flutter_camera_processing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
61 lines (46 loc) · 2 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Define the versions to download
opencv_version="4.7.0"
zxing_version="2.0.0"
# Define the paths to the directories where the files will be installed
projectPath="../"
opencvIOSPath="$projectPath/ios"
opencvIncludePath="$projectPath/src/"
opencvJNIPath="$projectPath/android/src/main/jniLibs/"
zxingPath="$projectPath/src/zxing"
# Create the download directory
mkdir -p download
cd download
# Download the opencv source code and unzip it
wget -O "opencv-$opencv_version-android-sdk.zip" "https://github.com/opencv/opencv/releases/download/$opencv_version/opencv-$opencv_version-android-sdk.zip"
wget -O "opencv-$opencv_version-ios-framework.zip" "https://github.com/opencv/opencv/releases/download/$opencv_version/opencv-$opencv_version-ios-framework.zip"
unzip "opencv-$opencv_version-android-sdk.zip"
unzip "opencv-$opencv_version-ios-framework.zip"
# remove opencv from ios project
rm -R "$opencvIOSPath/opencv2.framework"
# remove opencv from android project
rm -R "$opencvIncludePath/include"
rm -R "$opencvJNIPath"
# copy opencv to ios project
cp -R opencv2.framework "$opencvIOSPath"
# print success message for ios
echo "OpenCV $opencv_version for iOS has been successfully installed"
# copy opencv to android project
cp -R OpenCV-android-sdk/sdk/native/jni/include "$opencvIncludePath"
mkdir -p "$opencvJNIPath"
cp -R OpenCV-android-sdk/sdk/native/libs/* "$opencvJNIPath"
# print success message for android
echo "OpenCV $opencv_version for Android has been successfully installed"
# Download the zxing source code and unzip it
wget -O "zxing-cpp-$zxing_version.zip" "https://github.com/nu-book/zxing-cpp/archive/refs/tags/v$zxing_version.zip"
unzip "zxing-cpp-$zxing_version.zip"
# remove zxing from project
rm -R "$zxingPath"
# copy zxing
cp -R "zxing-cpp-$zxing_version/" "$zxingPath"
# print success message for zxing
echo "ZXing $zxing_version has been successfully installed"
# run the update_ios.sh script to copy the source files to the ios project
cd ..
sh update_ios.sh
# remove the downloaded files
rm -R download