-
-
Save dimitre/045167fb9c0aa4f7ea42bbd691f38565 to your computer and use it in GitHub Desktop.
Download and build OpenCV framework for macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
setup_opencv() | |
{ | |
printf "*********************************\n${FUNCNAME[0]}\n" | |
local readonly PARENT_FOLDER=${1:-third_party} | |
local readonly BASE_PATH=$CURRENT_PATH/$PARENT_FOLDER | |
######################################### | |
printf "download\n" | |
mkdir -p ${BASE_PATH}/opencv/source/ | |
cd ${BASE_PATH}/opencv/source/ | |
git clone https://github.com/opencv/opencv.git . --depth 1 | |
######################################### | |
printf "build\n" | |
cd ${BASE_PATH}/opencv/ | |
mkdir macos_build | |
cd ${BASE_PATH}/opencv/macos_build | |
python ../source/platforms/osx/build_framework.py osx | |
######################################### | |
printf "move framework\n" | |
mkdir -p ${BASE_PATH}/opencv/mac/ | |
mv osx/opencv2.framework/ ${BASE_PATH}/opencv/mac/opencv2.framework/ | |
######################################### | |
printf "delete source and build folder\n" | |
cd ${BASE_PATH}/opencv/ | |
rm -Rf ${BASE_PATH}/opencv/source | |
rm -Rf ${BASE_PATH}/opencv/macos_build | |
cd $CURRENT_PATH | |
} | |
main() | |
{ | |
local PARENT_PATH=${1:?"You need to pass in a parent folder"} | |
setup_opencv $PARENT_PATH | |
} | |
CURRENT_PATH=$PWD | |
main $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment