Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 9467b4e

Browse files
committed
[MacOS] Small changes to libtorch naming
Intel x86 libtorch builds will have `x86_64` suffix and Apple Silicon ones will have `arm64` ones, but latest will point to Intel ones for now.
1 parent 617327e commit 9467b4e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

wheel/build_wheel.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ mkdir -p "$whl_tmp_dir"
9999

100100
if [[ -n "$CROSS_COMPILE_ARM64" || $(uname -m) == "arm64" ]]; then
101101
mac_version='macosx_11_0_arm64'
102-
libtorch_arch='-arm64-'
102+
libtorch_arch='arm64'
103103
else
104104
mac_version='macosx_10_9_x86_64'
105-
libtorch_arch=''
105+
libtorch_arch='x86_64'
106106
fi
107107

108108
# Create a consistent wheel package name to rename the wheel to
@@ -266,7 +266,7 @@ else
266266
cp -r "$(pwd)/any_wheel/torch/lib/include" "$(pwd)/libtorch/"
267267
fi
268268
cp -r "$(pwd)/any_wheel/torch/share/cmake" "$(pwd)/libtorch/share/"
269-
if [[ "${libtorch_arch}" != "-arm64-" ]]; then
269+
if [[ "${libtorch_arch}" == "x86_64" ]]; then
270270
if [[ -x "$(pwd)/any_wheel/torch/.dylibs/libiomp5.dylib" ]]; then
271271
cp -r "$(pwd)/any_wheel/torch/.dylibs/libiomp5.dylib" "$(pwd)/libtorch/lib/"
272272
else
@@ -278,7 +278,12 @@ else
278278
echo $PYTORCH_BUILD_VERSION > libtorch/build-version
279279
echo "$(pushd $pytorch_rootdir && git rev-parse HEAD)" > libtorch/build-hash
280280

281-
zip -rq "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" libtorch
282-
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
283-
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-latest.zip"
281+
zip -rq "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" libtorch
282+
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
283+
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-latest.zip"
284+
if [[ "${libtorch_arch}" == "x86_64" ]]; then
285+
# For backward compatibility make unarched latest to point to x86_64
286+
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
287+
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-latest.zip"
288+
fi
284289
fi

0 commit comments

Comments
 (0)