Skip to content

Commit 67e4a7c

Browse files
committed
Add iphonesimulator-arm64 to cross compile for M1 simulator on x86 MacOS environment
1 parent 02ea0aa commit 67e4a7c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

build-libgit2-framework.sh

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export PATH=$PATH:$REPO_ROOT/tools/bin
1111
# needs multiple xcframeworks for x86_64-based and ARM-based Mac development computer.
1212

1313
# maccatalyst-arm64 macosx macosx-arm64
14-
if [[ $(arch) == 'arm64' ]]; then
15-
AVAILABLE_PLATFORMS=(iphoneos iphonesimulator maccatalyst-arm64)
16-
else
17-
AVAILABLE_PLATFORMS=(iphoneos iphonesimulator maccatalyst)
18-
fi
14+
#if [[ $(arch) == 'arm64' ]]; then
15+
AVAILABLE_PLATFORMS=(iphoneos iphonesimulator-arm64 maccatalyst-arm64)
16+
#else
17+
#AVAILABLE_PLATFORMS=(iphoneos iphonesimulator maccatalyst)
18+
#fi
1919

2020
# Download build tools
2121
test -d tools || wget -q https://github.com/light-tech/LLVM-On-iOS/releases/download/llvm12.0.0/tools.tar.xz
@@ -24,8 +24,8 @@ tar xzf tools.tar.xz
2424
### Setup common environment variables to run CMake for a given platform
2525
### Usage: setup_variables PLATFORM
2626
### where PLATFORM is the platform to build for and should be one of
27-
### iphoneos (implicitly arm64)
28-
### iphonesimulator (implicitly x86_64)
27+
### iphoneos (implicitly arm64)
28+
### iphonesimulator, iphonesimulator-arm64
2929
### maccatalyst, maccatalyst-arm64
3030
### macosx, macosx-arm64
3131
###
@@ -53,10 +53,15 @@ function setup_variables() {
5353
-DCMAKE_OSX_SYSROOT=$SYSROOT);;
5454

5555
"iphonesimulator")
56-
ARCH=$(arch)
56+
ARCH=x86_64
5757
SYSROOT=`xcodebuild -version -sdk iphonesimulator Path`
5858
CMAKE_ARGS+=(-DCMAKE_OSX_ARCHITECTURES=$ARCH -DCMAKE_OSX_SYSROOT=$SYSROOT);;
5959

60+
"iphonesimulator-arm64")
61+
ARCH=arm64
62+
SYSROOT=`xcodebuild -version -sdk iphonesimulator Path`
63+
CMAKE_ARGS+=(-DCMAKE_OSX_ARCHITECTURES=$ARCH -DCMAKE_OSX_SYSROOT=$SYSROOT);;
64+
6065
"maccatalyst")
6166
ARCH=x86_64
6267
SYSROOT=`xcodebuild -version -sdk macosx Path`
@@ -116,7 +121,7 @@ function build_openssl() {
116121
TARGET_OS=ios64-cross
117122
export CFLAGS="-isysroot $SYSROOT -arch $ARCH";;
118123

119-
"iphonesimulator")
124+
"iphonesimulator"|"iphonesimulator-arm64")
120125
TARGET_OS=iossimulator-xcrun
121126
export CFLAGS="-isysroot $SYSROOT";;
122127

0 commit comments

Comments
 (0)