Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Support WatchOS build #321

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmake/ProtoBuf.cmake
Expand Up @@ -28,8 +28,15 @@ function(custom_protobuf_find)
set(Protobuf_FOUND TRUE PARENT_SCOPE)
endfunction()

if (ANDROID OR IOS OR WIN32)
if (WIN32)
custom_protobuf_find()
elseif (ANDROID OR IOS)
custom_protobuf_find()
# For Androd or iOS, we won't need to build the libprotoc and protoc binaries
# because we will use the host protoc to build the proto files.
set_target_properties(
libprotoc protoc PROPERTIES
EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
else()
find_package( Protobuf )
if ( NOT (Protobuf_FOUND OR PROTOBUF_FOUND) )
Expand Down
8 changes: 7 additions & 1 deletion scripts/build_ios.sh
Expand Up @@ -22,11 +22,17 @@ $CAFFE2_ROOT/scripts/build_host_protoc.sh || exit 1
echo "Building caffe2"
cd $BUILD_ROOT

if [ -z ${IOS_PLATFORM+x} ]; then
# IOS_PLATFORM is not set, in which case we will default to OS, which
# builds iOS.
IOS_PLATFORM=OS
fi

cmake .. \
-DCMAKE_TOOLCHAIN_FILE=$CAFFE2_ROOT/third_party/ios-cmake/toolchain/iOS.cmake\
-DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Release \
-DIOS_PLATFORM=OS \
-DIOS_PLATFORM=${IOS_PLATFORM} \
-DUSE_CUDA=OFF \
-DBUILD_TEST=OFF \
-DBUILD_BINARY=OFF \
Expand Down