-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.sh
executable file
·46 lines (35 loc) · 1.55 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
# Define the versions to download
opencv_version="4.3.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/"
# 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"
# 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