diff --git a/build-xcframework.sh b/build-xcframework.sh index 2507de1c96b91..1968973bb287f 100755 --- a/build-xcframework.sh +++ b/build-xcframework.sh @@ -14,6 +14,22 @@ GGML_METAL_EMBED_LIBRARY=ON GGML_BLAS_DEFAULT=ON GGML_METAL_USE_BF16=ON +check_required_tool() { + local tool=$1 + local install_message=$2 + + if ! command -v $tool &> /dev/null; then + echo "Error: $tool is required but not found." + echo "$install_message" + exit 1 + fi +} + +echo "Checking for required tools..." +check_required_tool "cmake" "Please install CMake (brew install cmake)" +check_required_tool "xcodebuild" "Please install Xcode and Xcode Command Line Tools (xcode-select --install)" +check_required_tool "libtool" "Please install libtool which should be available with Xcode Command Line Tools (CLT). Make sure Xcode CLT is installed (xcode-select --install)" + set -xe rm -rf build-apple @@ -204,5 +220,5 @@ xcodebuild -create-xcframework \ -framework $(pwd)/build-visionos-sim/framework/llama.framework \ -output $(pwd)/build-apple/llama.xcframework -# The generated framework can be found in build-ios/llama.xcframework and +# The generated framework can be found in build-apple/llama.xcframework and # can be added to a projects "Frameworks, Libraries, and Embedded Content"