Skip to content

Commit

Permalink
llama : set GGML_NATIVE=OFF and add -mcpu=apple-a12
Browse files Browse the repository at this point in the history
This commit sets GGML_NATIVE=OFF and adds -mcpu=apple-a12 to the C and
C++ flags for the iOS simulator, iOS device, and macOS builds. This is
an attempt to avoid native compilation and also find a suitable target
architecture with regards to features tha the CPU supports.
  • Loading branch information
danbev committed Feb 26, 2025
1 parent 14d48be commit 5cecc8a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions build-xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ COMMON_CMAKE_ARGS=(
-DGGML_BLAS_DEFAULT=${GGML_BLAS_DEFAULT}
-DGGML_METAL=${GGML_METAL}
-DGGML_METAL_USE_BF16=${GGML_METAL_USE_BF16}
-DGGML_NATIVE=OFF
)

# Build for iOS simulator
Expand All @@ -131,6 +132,8 @@ cmake -B build-ios-sim -G Xcode \
-DCMAKE_OSX_SYSROOT=iphonesimulator \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS=iphonesimulator \
-DCMAKE_C_FLAGS="-mcpu=apple-a12" \
-DCMAKE_CXX_FLAGS="-mcpu=apple-a12" \
-S .
cmake --build build-ios-sim --config Release

Expand All @@ -141,6 +144,8 @@ cmake -B build-ios-device -G Xcode \
-DCMAKE_OSX_SYSROOT=iphoneos \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS=iphoneos \
-DCMAKE_C_FLAGS="-mcpu=apple-a12" \
-DCMAKE_CXX_FLAGS="-mcpu=apple-a12" \
-S .
cmake --build build-ios-device --config Release

Expand All @@ -150,6 +155,8 @@ cmake -B build-macos -G Xcode \
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOS_MIN_OS_VERSION} \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DCMAKE_C_FLAGS="-mcpu=apple-a12" \
-DCMAKE_CXX_FLAGS="-mcpu=apple-a12" \
-S .
cmake --build build-macos --config Release

Expand Down

0 comments on commit 5cecc8a

Please sign in to comment.