Skip to content

Commit

Permalink
Fix opencv arm64 (#193)
Browse files Browse the repository at this point in the history
#changelog #osx
  • Loading branch information
ofTheo authored Feb 10, 2021
1 parent d1273ba commit e1b06ea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions apothecary/formulas/opencv/opencv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ function build() {
set +e
cmake .. -DCMAKE_INSTALL_PREFIX=$LIB_FOLDER \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${OSX_MIN_SDK_VER} \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DENABLE_FAST_MATH=OFF \
-DCMAKE_CXX_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -std=c++11 -O3 -fPIC -arch arm64 -arch x86_64 -Wno-implicit-function-declaration -mmacosx-version-min=${OSX_MIN_SDK_VER}" \
-DCMAKE_C_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -O3 -fPIC -arch arm64 -arch x86_64 -Wno-implicit-function-declaration -mmacosx-version-min=${OSX_MIN_SDK_VER}" \
-DCMAKE_CXX_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -std=c++11 -O3 -fPIC -Wno-implicit-function-declaration -mmacosx-version-min=${OSX_MIN_SDK_VER}" \
-DCMAKE_C_FLAGS="-fvisibility-inlines-hidden -stdlib=libc++ -O3 -fPIC -Wno-implicit-function-declaration -mmacosx-version-min=${OSX_MIN_SDK_VER}" \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_DOCS=OFF \
Expand Down Expand Up @@ -127,10 +128,11 @@ function build() {
echo "Make install Successful"

echo "--------------------"
echo "Joining all libs in one"
outputlist="$LIB_FOLDER/lib/lib*.a $LIB_FOLDER/lib/opencv4/3rdparty/*.a"
libtool -static $outputlist -o "$LIB_FOLDER/lib/opencv.a" 2>&1 | tee -a ${LOG}
echo "Joining all libs in one Successful"
# we don't do this anymore as it results in duplicate symbol issues
# echo "Joining all libs in one"
# outputlist="$LIB_FOLDER/lib/lib*.a $LIB_FOLDER/lib/opencv4/3rdparty/*.a"
# libtool -static $outputlist -o "$LIB_FOLDER/lib/opencv.a" 2>&1 | tee -a ${LOG}
# echo "Joining all libs in one Successful"

elif [ "$TYPE" == "vs" ] ; then
unset TMP
Expand Down Expand Up @@ -587,7 +589,8 @@ function copy() {
cp -R modules/*/include/opencv2/* $1/include/opencv2/

# copy lib
cp -R $LIB_FOLDER/lib/opencv.a $1/lib/$TYPE/
cp -R $LIB_FOLDER/lib/lib*.a $1/lib/$TYPE/
cp -R $LIB_FOLDER/lib/opencv4/3rdparty/*.a $1/lib/$TYPE/

elif [ "$TYPE" == "vs" ] ; then
if [ $ARCH == 32 ] ; then
Expand Down

0 comments on commit e1b06ea

Please sign in to comment.