fix binaries build for BUILD_CAFFE2_MOBILE=OFF (#25229)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25229

The binaries don't build when BUILD_CAFFE2_MOBILE=OFF (libtorch mode)
in which case we don't include caffe2/predictor which is needed by
predictor_verifier.cc.

Add BUILD_BINARY=ON to libtorch android CI script to make sure binaries
can be compiled for libtorch android as we will add speed benchmark
binary for it.

Test Plan:
- Verified BUILD_BINARY=ON works with BUILD_CAFFE2_MOBILE=OFF and ON.
- Will check CI builds.

Differential Revision: D17067217

Pulled By: ljk53

fbshipit-source-id: 2a28139d9d25ff738be7b49b24849c9d300ef9a9
This commit is contained in:
Jiakai Liu
2019-08-29 19:32:55 -07:00
committed by Facebook Github Bot
parent 1294e55c15
commit e370486d80
2 changed files with 8 additions and 5 deletions

View File

@ -65,6 +65,7 @@ fi
if [[ "${BUILD_ENVIRONMENT}" == *-android* ]]; then
export ANDROID_NDK=/opt/ndk
build_args=()
build_args+=("-DBUILD_BINARY=ON")
build_args+=("-DBUILD_CAFFE2_MOBILE=OFF")
build_args+=("-DBUILD_SHARED_LIBS=ON")

View File

@ -1,8 +1,8 @@
caffe2_binary_target("convert_caffe_image_db.cc")
caffe2_binary_target("convert_db.cc")
caffe2_binary_target("make_cifar_db.cc")
caffe2_binary_target("make_mnist_db.cc")
if (NOT ANDROID)
caffe2_binary_target("convert_caffe_image_db.cc")
caffe2_binary_target("convert_db.cc")
caffe2_binary_target("make_cifar_db.cc")
caffe2_binary_target("make_mnist_db.cc")
caffe2_binary_target("parallel_info.cc")
target_include_directories(parallel_info PUBLIC
${CMAKE_BINARY_DIR}/aten/src) # provides "ATen/TypeExtendedInterface.h" to ATen.h
@ -15,7 +15,9 @@ if (NOT ANDROID)
target_include_directories(at_launch_benchmark PUBLIC
${CMAKE_BINARY_DIR}/aten/src)
endif()
caffe2_binary_target("predictor_verifier.cc")
if (NOT INTERN_BUILD_MOBILE OR BUILD_CAFFE2_MOBILE)
caffe2_binary_target("predictor_verifier.cc")
endif()
caffe2_binary_target("print_registered_core_operators.cc")
caffe2_binary_target("run_plan.cc")
caffe2_binary_target("speed_benchmark.cc")