forked from holzschu/python3_ios
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_openblas.sh
executable file
·29 lines (25 loc) · 2.51 KB
/
build_openblas.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
# Building for iOS:
# This works for version 2.20.
# OpenBlas is now at version 3.37, but compilation for iOS is still problematic.
# I tried with this here: https://github.com/xianyi/OpenBLAS/issues/1687
# but did not get a full working library
echo "Uncompress OpenBLAS and compile:"
rm -rf OpenBLAS-0.2.20/
# download does not work, please download manually from: https://github.com/xianyi/OpenBLAS/releases/tag/v0.2.20
# curl -OL https://github.com/xianyi/OpenBLAS/archive/v0.2.20.tar.gz
tar -xzf OpenBLAS-0.2.20.tar.gz
(cd OpenBLAS-0.2.20/ ; make HOSTCC="clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/" CC="clang -arch arm64 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ " TARGET=ARMV8 AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" NOFORTRAN="1" NO_SHARED="1" ; make HOSTCC="clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/" CC="clang -arch arm64 -miphoneos-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/ " TARGET=ARMV8 AR="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar" NOFORTRAN="1" NO_SHARED="1" install PREFIX=./install ; cd ..)
echo "Creating framework:"
# Create openblas framework:
rm -rf Frameworks/openblas.framework
mkdir Frameworks/openblas.framework
mkdir Frameworks/openblas.framework/Headers
cp OpenBLAS-0.2.20/install/include/*.h Frameworks/openblas.framework/Headers
libtool -no_warning_for_no_symbols -dynamic -undefined dynamic_lookup -ios_version_min 11.0 -install_name @rpath/openblas.framework/openblas -o Frameworks/openblas.framework/openblas OpenBLAS-0.2.20/libopenblas_armv8p-r0.2.20.a
cp plists/openblas_Info.plist Frameworks/openblas.framework/Info.plist
# echo "Cleanup:"
#
# To build OpenBLAS for OSX:
# make hostcc="clang -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx.sdk/" cc="clang -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx.sdk/"
# then install:
# make hostcc="clang -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx.sdk/" cc="clang -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx.sdk/" install prefix=/usr/local/