Spaces:
Running
Running
xcf : use check for visionos build version (#3021)
Browse filesThis commit adds a check for the visionos build version used with vtool
in build-xcframework.sh. The script now checks the Xcode version and
determines whether to use "xros" or "visionos" for the build version.
This commit also uses xcrun for the vtool so that the version of vtool
in xcode command line tools is used instead of the one in the system
path.
Refs: https://github.com/ggml-org/whisper.cpp/pull/2994#issuecomment-2773292223
- build-xcframework.sh +16 -4
build-xcframework.sh
CHANGED
|
@@ -41,6 +41,11 @@ COMMON_CMAKE_ARGS=(
|
|
| 41 |
-DGGML_OPENMP=${GGML_OPENMP}
|
| 42 |
)
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
check_required_tool() {
|
| 45 |
local tool=$1
|
| 46 |
local install_message=$2
|
|
@@ -335,21 +340,28 @@ combine_static_libraries() {
|
|
| 335 |
|
| 336 |
# Platform-specific post-processing for device builds
|
| 337 |
if [[ "$is_simulator" == "false" ]]; then
|
| 338 |
-
if command -v vtool &>/dev/null; then
|
| 339 |
case "$platform" in
|
| 340 |
"ios")
|
| 341 |
echo "Marking binary as a framework binary for iOS..."
|
| 342 |
-
vtool -set-build-version ios ${IOS_MIN_OS_VERSION} ${IOS_MIN_OS_VERSION} -replace \
|
| 343 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 344 |
;;
|
| 345 |
"visionos")
|
| 346 |
echo "Marking binary as a framework binary for visionOS..."
|
| 347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 349 |
;;
|
| 350 |
"tvos")
|
| 351 |
echo "Marking binary as a framework binary for tvOS..."
|
| 352 |
-
vtool -set-build-version tvos ${TVOS_MIN_OS_VERSION} ${TVOS_MIN_OS_VERSION} -replace \
|
| 353 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 354 |
;;
|
| 355 |
esac
|
|
|
|
| 41 |
-DGGML_OPENMP=${GGML_OPENMP}
|
| 42 |
)
|
| 43 |
|
| 44 |
+
XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n1 | awk '{ print $2 }')
|
| 45 |
+
MAJOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f1)
|
| 46 |
+
MINOR_VERSION=$(echo $XCODE_VERSION | cut -d. -f2)
|
| 47 |
+
echo "Detected Xcode version: $XCODE_VERSION"
|
| 48 |
+
|
| 49 |
check_required_tool() {
|
| 50 |
local tool=$1
|
| 51 |
local install_message=$2
|
|
|
|
| 340 |
|
| 341 |
# Platform-specific post-processing for device builds
|
| 342 |
if [[ "$is_simulator" == "false" ]]; then
|
| 343 |
+
if command -v xcrun vtool &>/dev/null; then
|
| 344 |
case "$platform" in
|
| 345 |
"ios")
|
| 346 |
echo "Marking binary as a framework binary for iOS..."
|
| 347 |
+
xcrun vtool -set-build-version ios ${IOS_MIN_OS_VERSION} ${IOS_MIN_OS_VERSION} -replace \
|
| 348 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 349 |
;;
|
| 350 |
"visionos")
|
| 351 |
echo "Marking binary as a framework binary for visionOS..."
|
| 352 |
+
if [[ "$MAJOR_VERSION" -gt 16 ]] || [[ "$MAJOR_VERSION" -eq 16 && "$MINOR_VERSION" -gt 2 ]]; then
|
| 353 |
+
echo "Xcode version greater than 16.2, using visionOS."
|
| 354 |
+
VISION_OS_BUILD_VERSION="visionos"
|
| 355 |
+
else
|
| 356 |
+
echo "Xcode version less than or equal to 16.2, using xros."
|
| 357 |
+
VISION_OS_BUILD_VERSION="xros"
|
| 358 |
+
fi
|
| 359 |
+
xcrun vtool -set-build-version ${VISION_OS_BUILD_VERSION} ${VISIONOS_MIN_OS_VERSION} ${VISIONOS_MIN_OS_VERSION} -replace \
|
| 360 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 361 |
;;
|
| 362 |
"tvos")
|
| 363 |
echo "Marking binary as a framework binary for tvOS..."
|
| 364 |
+
xcrun vtool -set-build-version tvos ${TVOS_MIN_OS_VERSION} ${TVOS_MIN_OS_VERSION} -replace \
|
| 365 |
-output "${base_dir}/${output_lib}" "${base_dir}/${output_lib}"
|
| 366 |
;;
|
| 367 |
esac
|