mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[iOS] Add watchOS support (#33318)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33318 ### Summary Recently, we have a [discussion](https://discuss.pytorch.org/t/libtorch-on-watchos/69073/14) in the forum about watchOS. This PR adds the support for building watchOS libraries. ### Test Plan - `BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=WATCHOS ./scripts/build_ios.sh` Test Plan: Imported from OSS Differential Revision: D19896534 Pulled By: xta0 fbshipit-source-id: 7b9286475e895d9fefd998246e7090ac92c4c9b6
This commit is contained in:
parent
ecd9a5ad12
commit
9c0625b004
|
|
@ -343,7 +343,6 @@ if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
|
|||
set(FEATURE_TORCH_MOBILE ON)
|
||||
set(NO_API ON)
|
||||
set(USE_FBGEMM OFF)
|
||||
set(USE_PYTORCH_QNNPACK ON)
|
||||
set(USE_QNNPACK OFF)
|
||||
set(INTERN_DISABLE_ONNX ON)
|
||||
set(INTERN_DISABLE_AUTOGRAD ON)
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@ function (caffe2_print_configuration_summary)
|
|||
message(STATUS " USE_TBB : ${USE_TBB}")
|
||||
message(STATUS " USE_PROF : ${USE_PROF}")
|
||||
message(STATUS " USE_QNNPACK : ${USE_QNNPACK}")
|
||||
message(STATUS " USE_PYTORCH_QNNPACK : ${USE_PYTORCH_QNNPACK}")
|
||||
message(STATUS " USE_REDIS : ${USE_REDIS}")
|
||||
message(STATUS " USE_ROCKSDB : ${USE_ROCKSDB}")
|
||||
message(STATUS " USE_ZMQ : ${USE_ZMQ}")
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ if (IOS_PLATFORM STREQUAL "OS")
|
|||
elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
|
||||
set (DEFAULT_IOS_ARCH "x86_64")
|
||||
elseif (IOS_PLATFORM STREQUAL "WATCHOS")
|
||||
set (DEFAULT_IOS_ARCH "armv7k")
|
||||
set (DEFAULT_IOS_ARCH "armv7k;arm64_32")
|
||||
endif ()
|
||||
|
||||
set (IOS_ARCH ${DEFAULT_IOS_ARCH} CACHE string "Build architecture for iOS")
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ if [ -n "${IOS_PLATFORM:-}" ]; then
|
|||
if [ "${IOS_PLATFORM}" == "SIMULATOR" ]; then
|
||||
# iOS Simulator build is not supported by NNPACK
|
||||
CMAKE_ARGS+=("-DUSE_NNPACK=OFF")
|
||||
elif [ "${IOS_PLATFORM}" == "WATCHOS" ]; then
|
||||
# enable bitcode by default for watchos
|
||||
CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode")
|
||||
CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
|
||||
# disable the QNNPACK
|
||||
CMAKE_ARGS+=("-DUSE_PYTORCH_QNNPACK=OFF")
|
||||
fi
|
||||
else
|
||||
# IOS_PLATFORM is not set, default to OS, which builds iOS.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user