| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This script configures clang to target the iOS simulator. If you'd like to |
| 4 |
# build for real iOS devices, change SDK to "iphoneos" and PLATFORM to "ios". |
| 5 |
# This uses the latest available iOS SDK, which is recommended. To select a |
| 6 |
# specific SDK, run 'xcodebuild -showsdks' to see the available SDKs and replace |
| 7 |
# iphonesimulator with one of them. |
| 8 |
|
| 9 |
SDK=iphonesimulator |
| 10 |
PLATFORM=ios-simulator |
| 11 |
|
| 12 |
if [ "$GOARCH" == "arm64" ]; then |
| 13 |
CLANGARCH="arm64" |
| 14 |
else |
| 15 |
CLANGARCH="x86_64" |
| 16 |
fi |
| 17 |
|
| 18 |
SDK_PATH=`xcrun --sdk $SDK --show-sdk-path` |
| 19 |
|
| 20 |
# cmd/cgo doesn't support llvm-gcc-4.2, so we have to use clang. |
| 21 |
CLANG=`xcrun --sdk $SDK --find clang` |
| 22 |
|
| 23 |
exec "$CLANG" -arch $CLANGARCH -isysroot "$SDK_PATH" -m${PLATFORM}-version-min=12.0 "$@" |